A service for registering C# functions as script handlers dynamically.
More...
|
int | ExecutionOrder [get] |
|
int | ExecutionOrder [get] |
|
A service for registering C# functions as script handlers dynamically.
◆ CreateUniqueHandler()
Creates a unique script callback handle for the specified callback method.
The returned handle can be used for certain API functions that take a script name as a parameter.
- Parameters
-
handler | The callback function. |
- Returns
- The callback handle.
◆ IsScriptRegistered()
bool Anvil.Services.ScriptHandleFactory.IsScriptRegistered |
( |
string |
scriptName | ) |
|
|
inline |
Gets if the specified script name has a script handler already defined.
- Parameters
-
scriptName | The script name to query. |
- Returns
- True if a handler already exists, otherwise false.
◆ RegisterScriptHandler()
ScriptCallbackHandle Anvil.Services.ScriptHandleFactory.RegisterScriptHandler |
( |
string |
scriptName, |
|
|
Func< CallInfo, ScriptHandleResult > |
callback |
|
) |
| |
|
inline |
Registers the specified action as a callback for the specified script name.
- Parameters
-
scriptName | The script name to be handled. |
callback | The function invoked when this script is called by the Virtual Machine. |
- Returns
- A handle that can be disposed to remove the handler.
- Exceptions
-
ArgumentException | Thrown if the specified script name is internally used by Anvil. |
InvalidOperationException | Thrown if the specified script already has a handler defined. |
◆ UnregisterScriptHandler()
bool Anvil.Services.ScriptHandleFactory.UnregisterScriptHandler |
( |
string |
scriptName | ) |
|
|
inline |
Unregisters any handler assigned to the specified script.
- Parameters
-
scriptName | The script name to unregister. |
- Returns
- True if a handler was removed, false if nothing was removed.
The documentation for this class was generated from the following file:
- NWN.Anvil/src/main/Services/ScriptDispatch/ScriptHandleFactory.cs