Event unbind - rasikhq/VCMP-Lua GitHub Wiki
Event Manager
unbind
Un-Binds a function handler from an event.
bool Event.unbind(string eventName, function handler)
Parameters
- string eventName - The event to trigger
- function handler - The function handler to remove
NOTE: Anonymous handlers cannot be unbound
Returns
bool - true if the event was successfully unbound, false if something went wrong.
Example
function myOnServerStart()
Logger.info("Server started!")
end
Event.bind("onServerInit", myOnServerStart) -- bind a handler
-- Lets remove it now
Event.unbind("onServerInit", myOnServerStart)
Event.bind("onServerInit", function() -- bind an anonymous function
Logger.info("The server init event was triggered!")
end)