]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Free arguments of cancelled minetest.after() jobs
authorsfan5 <sfan5@live.de>
Tue, 18 Jan 2022 18:25:53 +0000 (19:25 +0100)
committersfan5 <sfan5@live.de>
Wed, 19 Jan 2022 22:30:18 +0000 (23:30 +0100)
builtin/common/after.lua

index e20f292f0240ab69e83e0369c1ae1f29fe775354..bce2625370cd63f80ffdca83497895e937c9ec90 100644 (file)
@@ -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