projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a016a6
)
Fix indexing error in timer processing
author
Zefram
<zefram@fysh.org>
Wed, 16 Jul 2014 15:24:39 +0000
(17:24 +0200)
committer
sapier
<Sapier at GMX dot net>
Wed, 16 Jul 2014 15:24:39 +0000
(17:24 +0200)
builtin/game/misc.lua
patch
|
blob
|
history
diff --git
a/builtin/game/misc.lua
b/builtin/game/misc.lua
index 4afcdb99e59c91a1d563a7cce326a2795e11425a..a392386f13cd53fba257b47f63d264b411174db1 100644
(file)
--- 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)