From: PilzAdam Date: Mon, 18 Mar 2013 23:13:00 +0000 (+0100) Subject: Prevent passing nil to unpack() in minetest.after X-Git-Tag: 0.4.6~22^2~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d6026a5fee11722798ddcb1e4d0b5638f16ba9ce;p=oweals%2Fminetest.git Prevent passing nil to unpack() in minetest.after --- diff --git a/builtin/misc.lua b/builtin/misc.lua index 2cc76e8ec..8308b3d6b 100644 --- a/builtin/misc.lua +++ b/builtin/misc.lua @@ -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)