21 lines
510 B
Lua
21 lines
510 B
Lua
function scheduleEvent(func, delay)
|
|
local event = g_dispatcher.scheduleEvent(callback, delay)
|
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
event._callback = callback
|
|
return event
|
|
end
|
|
|
|
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
|
|
end
|
|
|
|
function removeEvent(event)
|
|
if event then
|
|
event:cancel()
|
|
end
|
|
end
|