Browse Source

Free arguments of cancelled minetest.after() jobs

sfan5 2 years ago
parent
commit
4f6f09590c
1 changed files with 8 additions and 1 deletions
  1. 8 1
      builtin/common/after.lua

+ 8 - 1
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