mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Extend notification script loading with support for context.
This replaces the second argument from callback. Initial implementation was missing this feature.
This commit is contained in:
@ -148,9 +148,10 @@ void ScriptSrc::Process()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ScriptSrc::ScriptSrc(const String & path, Function & cb, bool delay, bool info) // NOLINT(modernize-pass-by-value)
|
||||
ScriptSrc::ScriptSrc(const String & path, Function & cb, LightObj & ctx, bool delay, bool info) // NOLINT(modernize-pass-by-value)
|
||||
: mExec()
|
||||
, mFunc(std::move(cb))
|
||||
, mCtx(std::move(ctx))
|
||||
, mPath(path)
|
||||
, mData()
|
||||
, mLine()
|
||||
|
@ -27,6 +27,7 @@ struct ScriptSrc
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Script mExec{}; // Reference to the script object.
|
||||
Function mFunc{}; // Callback to invoke after script was executed.
|
||||
LightObj mCtx{}; // Object to be passed over to the callback as context.
|
||||
String mPath{}; // Path to the script file.
|
||||
String mData{}; // The contents of the script file.
|
||||
Line mLine{}; // List of lines of code in the data.
|
||||
@ -41,7 +42,7 @@ struct ScriptSrc
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Base constructor.
|
||||
*/
|
||||
explicit ScriptSrc(const String & path, Function & cb, bool delay = false, bool info = false);
|
||||
explicit ScriptSrc(const String & path, Function & cb, LightObj & ctx, bool delay = false, bool info = false);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
|
Reference in New Issue
Block a user