Prevent passing nil to unpack() in minetest.after

master
PilzAdam 2013-03-19 00:13:00 +01:00
parent 939397dd6e
commit d6026a5fee
1 changed files with 2 additions and 2 deletions

View File

@ -14,14 +14,14 @@ minetest.register_globalstep(function(dtime)
for index, timer in ipairs(minetest.timers) do for index, timer in ipairs(minetest.timers) do
timer.time = timer.time - dtime timer.time = timer.time - dtime
if timer.time <= 0 then if timer.time <= 0 then
timer.func(unpack(timer.args)) timer.func(unpack(timer.args or {}))
table.remove(minetest.timers,index) table.remove(minetest.timers,index)
end end
end end
end) end)
function minetest.after(time, func, ...) function minetest.after(time, func, ...)
table.insert(minetest.timers_to_add, {time=time, func=func, args=arg}) table.insert(minetest.timers_to_add, {time=time, func=func, args={...}})
end end
function minetest.check_player_privs(name, privs) function minetest.check_player_privs(name, privs)