aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-01-18 19:25:53 +0100
committersfan5 <sfan5@live.de>2022-01-19 23:30:18 +0100
commit4f6f09590c65187071096cceac5872293bc53b2f (patch)
treef3f6012f4312b689ff6e76c81ea250e0a3d43ca5
parent7c321ad7f52eeefcd249f4268a2bf18ec12058cd (diff)
downloadminetest-4f6f09590c65187071096cceac5872293bc53b2f.tar.gz
minetest-4f6f09590c65187071096cceac5872293bc53b2f.tar.bz2
minetest-4f6f09590c65187071096cceac5872293bc53b2f.zip
Free arguments of cancelled minetest.after() jobs
-rw-r--r--builtin/common/after.lua9
1 files changed, 8 insertions, 1 deletions
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