Created
March 12, 2016 16:16
-
-
Save qoh/178585f5a08eccb83053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local schedule = ts.func "schedule" | |
if _G._TIMER_COUNT == nil then _G._TIMER_COUNT = 0 end | |
if _G._TIMER_TABLE == nil then _G._TIMER_TABLE = {} end | |
function _G._TIMER_FINISH(i) | |
i = tonumber(i) | |
_G._TIMER_TABLE[i]() | |
_G._TIMER_TABLE[i] = nil | |
end | |
return function(t, f) | |
local i = _G._TIMER_COUNT | |
_G._TIMER_COUNT = _G._TIMER_COUNT + 1 | |
_G._TIMER_TABLE[i] = f | |
return schedule(t, "0", "luaCall", "_TIMER_FINISH", i) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment