mirror of
https://github.com/vrld/hump.git
synced 2024-12-06 13:24:21 +00:00
shorten code, add comment
This commit is contained in:
parent
dde34f98a9
commit
e33ffbe855
10
timer.lua
10
timer.lua
@ -32,14 +32,14 @@ local function _nothing_() end
|
||||
function Timer:update(dt)
|
||||
local to_remove = {}
|
||||
|
||||
local handles = {}
|
||||
local len = 0
|
||||
-- timers may create new timers, which leads to undefined behavior
|
||||
-- in pairs() - so we need to put them in a different table first
|
||||
local to_update = {}
|
||||
for handle in pairs(self.functions) do
|
||||
len = len + 1
|
||||
handles[len] = handle
|
||||
to_update[handle] = handle
|
||||
end
|
||||
|
||||
for _, handle in ipairs(handles) do
|
||||
for handle in pairs(to_update) do
|
||||
-- handle: {
|
||||
-- time = <number>,
|
||||
-- after = <function>,
|
||||
|
Loading…
Reference in New Issue
Block a user