bool removeEventHandler(string eventName, element attachedTo, function handler)
Parameters
| Name | Type | Description |
|---|---|---|
| eventName | string | The event's name. |
| attachedTo | element | The same element given to addEventHandler. |
| handler | function | The same function given to addEventHandler. |
Returns
true if it was removed, false if that function was not on that event of that element.
A handler removed while the event is already running is not called for the rest of that trigger.
Example
local function onFirstSpawn()
outputDebugString(getPlayerName(source) .. " spawned for the first time")
removeEventHandler("onPlayerSpawn", source, onFirstSpawn)
end
addEventHandler("onPlayerJoin", root, function()
addEventHandler("onPlayerSpawn", source, onFirstSpawn)
end)