- Documentation
- Shared functions
- removeEventHandler
Function
removeEventHandler
Detaches a function from an event. You must pass the same name, element and the same function (the same variable) as in addEventHandler - an anonymous function written again is a different function.
Syntax
bool removeEventHandler(string eventName, element attachedTo, function functionVar)Arguments
eventNamestring- Event name.
attachedToelement- The element the function is attached to.
functionVarfunction- The same function.
Returns
true when detached; false when it was not attached.
Example
local function drawSpeed()
dxDrawText("Predkosc", 20, 20)
end
addEventHandler("onClientRender", root, drawSpeed)
setTimer(function() removeEventHandler("onClientRender", root, drawSpeed) end, 10000, 1)