Skip to content

Commit

Permalink
Fix indexing error in timer processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zefram authored and sapier committed Jul 16, 2014
1 parent 9a016a6 commit aebbcbf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin/game/misc.lua
Expand Up @@ -11,11 +11,15 @@ core.register_globalstep(function(dtime)
table.insert(core.timers, timer)
end
core.timers_to_add = {}
for index, timer in ipairs(core.timers) do
local index = 1
while index <= #core.timers do
local timer = core.timers[index]
timer.time = timer.time - dtime
if timer.time <= 0 then
timer.func(unpack(timer.args or {}))
table.remove(core.timers,index)
else
index = index + 1
end
end
end)
Expand Down

0 comments on commit aebbcbf

Please sign in to comment.