Prevent passing nil to unpack() in minetest.after
parent
939397dd6e
commit
d6026a5fee
|
@ -14,14 +14,14 @@ minetest.register_globalstep(function(dtime)
|
|||
for index, timer in ipairs(minetest.timers) do
|
||||
timer.time = timer.time - dtime
|
||||
if timer.time <= 0 then
|
||||
timer.func(unpack(timer.args))
|
||||
timer.func(unpack(timer.args or {}))
|
||||
table.remove(minetest.timers,index)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
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
|
||||
|
||||
function minetest.check_player_privs(name, privs)
|
||||
|
|
Loading…
Reference in New Issue