diff options
author | Zefram <zefram@fysh.org> | 2014-07-16 17:24:39 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-07-16 17:24:39 +0200 |
commit | aebbcbf398a9dde6b2cbc8ab05c103f44f6f703d (patch) | |
tree | 73892303fb3c2a2b30762a133cec190a30574444 | |
parent | 9a016a6294f289e1687b9a4655ea3f02f2208201 (diff) | |
download | minetest-aebbcbf398a9dde6b2cbc8ab05c103f44f6f703d.tar.gz minetest-aebbcbf398a9dde6b2cbc8ab05c103f44f6f703d.tar.bz2 minetest-aebbcbf398a9dde6b2cbc8ab05c103f44f6f703d.zip |
Fix indexing error in timer processing
-rw-r--r-- | builtin/game/misc.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index 4afcdb99e..a392386f1 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -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) |