Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

register_callback

Registers a "frozen" callback handler,

For example, this code:

register_callback("on_script_unloaded", my_unload_handler)

function my_unload_handler()
    print("handling unload!")
end

would call the my_unload_handler function, whenever the on_script_unloaded callback is triggered, which is when your script is about to be unloaded.

Registered callbacks take precedence over free-standing function callbacks, i.e. the below top level function:

function on_script_unloaded()
    print("freestanding unload handler!")
end

would be a valid handler, but if a registered callback existed, it would be called instead.

Arguments

NameTypeDocumentation
callbackStringthe callback label to register this function against.
functionDynamicFunctionthe callback function which will be stored as a handler for this callback label.

Returns

NameTypeDocumentation
arg0()No Documentation 🚧