Method RegisterScriptHandler
RegisterScriptHandler(string, Func<CallInfo, ScriptHandleResult>)
Registers the specified action as a callback for the specified script name.
public ScriptCallbackHandle RegisterScriptHandler(string scriptName, Func<CallInfo, ScriptHandleResult> callback)
Parameters
scriptNamestringThe script name to be handled.
callbackFunc<CallInfo, ScriptHandleResult>The function invoked when this script is called by the Virtual Machine.
Returns
- ScriptCallbackHandle
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.