Prevent passing nil to unpack() in minetest.after
authorPilzAdam <pilzadam@minetest.net>
Mon, 18 Mar 2013 23:13:00 +0000 (00:13 +0100)
committerPilzAdam <pilzadam@minetest.net>
Mon, 18 Mar 2013 23:15:41 +0000 (00:15 +0100)
builtin/misc.lua

index 2cc76e8ec5aebdf40be6142a75ad623e180eaf34..8308b3d6b4d3e4250df0203710990c3085eb304f 100644 (file)
@@ -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)