1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-17 14:55:13 -05:00

Prevent passing nil to unpack() in minetest.after

This commit is contained in:
PilzAdam 2013-03-19 00:13:00 +01:00
parent 939397dd6e
commit d6026a5fee

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)