Free arguments of cancelled minetest.after() jobs

This commit is contained in:
sfan5 2022-01-18 19:25:53 +01:00
parent 7c321ad7f5
commit 4f6f09590c

@ -37,7 +37,14 @@ function core.after(after, func, ...)
arg = {...}, arg = {...},
mod_origin = core.get_last_run_mod(), mod_origin = core.get_last_run_mod(),
} }
jobs[#jobs + 1] = new_job jobs[#jobs + 1] = new_job
time_next = math.min(time_next, expire) 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 end