From 5d3c011f796a7f6753725e712032e0c8a32893ab Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Wed, 19 Jan 2022 16:15:43 +0100 Subject: [PATCH] after: add nil support --- minetest/misc.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/minetest/misc.lua b/minetest/misc.lua index 583d8e2..e4e5f7b 100644 --- a/minetest/misc.lua +++ b/minetest/misc.lua @@ -1,6 +1,6 @@ -- Localize globals -local Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, table, type, unpack - = Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, table, type, unpack +local Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, select, table, type, unpack + = Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, select, table, type, unpack -- Set environment local _ENV = ... @@ -29,6 +29,7 @@ function after(seconds, func, ...) local job = setmetatable({ time = time + seconds, func = func, + ["#"] = select("#", ...), ... }, job_metatable) jobs:push(job) @@ -39,7 +40,7 @@ minetest.register_globalstep(function(dtime) local job = jobs[1] while job and job.time <= time do if not job.cancelled then - job.func(unpack(job)) + job.func(unpack(job, 1, job["#"])) end jobs:pop() job = jobs[1]