tibia-client/modules/corelib/globals.lua

41 lines
942 B
Lua
Raw Normal View History

2012-06-26 00:13:30 +02:00
-- @docvars @{
2012-06-26 00:13:30 +02:00
-- root widget
rootWidget = g_ui.getRootWidget()
2012-01-05 02:28:29 +01:00
-- G is used as a global table to save variables in memory between reloads
G = G or {}
2012-06-26 00:13:30 +02:00
-- @}
2012-06-26 00:13:30 +02:00
-- @docfuncs @{
2012-02-06 20:19:47 +01:00
function scheduleEvent(callback, delay)
2012-06-26 00:13:30 +02: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
end
function addEvent(callback, front)
2012-06-26 00:13:30 +02:00
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
2012-06-06 22:14:53 +02:00
function cycleEvent(callback, front)
2012-06-26 00:13:30 +02:00
local event = g_dispatcher.cycleEvent(callback, front)
2012-06-06 22:14:53 +02:00
-- 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()
event._callback = nil
end
end
2012-06-26 00:13:30 +02:00
-- @}