RemoveEventHandler
removeEventHandler
Removes a previously registered event callback.
Syntax
bool removeEventHandler(string eventName, element attachedTo, function handler)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
eventName |
string |
yes | The event from which to remove the handler. |
attachedTo |
element |
yes | The same attachment target used with addEventHandler.
|
handler |
function |
yes | The exact Lua function previously registered. |
Returns
Returns true if a matching handler was removed; otherwise returns false.
Examples
Register and later remove a handler:
local function onRoundEnd()
print("Round ended")
end
addEventHandler("round:end", root, onRoundEnd)
removeEventHandler("round:end", root, onRoundEnd)
Notes
- Available in both client-side and server-side resource scripts.