tibia-client/modules/core_lib/dispatcher.lua

21 lines
510 B
Lua
Raw Normal View History

function scheduleEvent(func, delay)
2012-02-06 20:19:47 +01:00
local event = g_dispatcher.scheduleEvent(callback, delay)
-- must hold a reference to the callback, otherwise it would be collected
event._callback = callback
return event
2011-11-07 01:14:51 +01:00
end
2012-02-06 20:19:47 +01:00
function addEvent(callback, front)
local event = g_dispatcher.addEvent(callback, front)
-- must hold a reference to the callback, otherwise it would be collected
event._callback = callback
return event
2011-12-07 01:31:55 +01:00
end
2012-02-06 20:19:47 +01:00
function removeEvent(event)
if event then
event:cancel()
2011-11-07 01:14:51 +01:00
end
end