From 4f6f09590c65187071096cceac5872293bc53b2f Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 18 Jan 2022 19:25:53 +0100 Subject: Free arguments of cancelled minetest.after() jobs --- builtin/common/after.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'builtin/common/after.lua') diff --git a/builtin/common/after.lua b/builtin/common/after.lua index e20f292f0..bce262537 100644 --- a/builtin/common/after.lua +++ b/builtin/common/after.lua @@ -37,7 +37,14 @@ function core.after(after, func, ...) arg = {...}, mod_origin = core.get_last_run_mod(), } + jobs[#jobs + 1] = new_job time_next = math.min(time_next, expire) - return { cancel = function() new_job.func = function() end end } + + return { + cancel = function() + new_job.func = function() end + new_job.args = {} + end + } end -- cgit v1.2.3