aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/misc.lua
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-08-11 22:27:54 -0400
committerkwolekr <kwolekr@minetest.net>2015-08-12 23:56:12 -0400
commit2b04ab874d75711bc021a0cd8dc7fca68f4e6929 (patch)
tree04c1e9ad914c8c744cfd1055e2a8f6620d924c8b /builtin/game/misc.lua
parent738fbc66d096575bb9a1694056ce2d627a70c03d (diff)
downloadminetest-2b04ab874d75711bc021a0cd8dc7fca68f4e6929.tar.gz
minetest-2b04ab874d75711bc021a0cd8dc7fca68f4e6929.tar.bz2
minetest-2b04ab874d75711bc021a0cd8dc7fca68f4e6929.zip
SAPI: Track last executed mod and include in error messages
Diffstat (limited to 'builtin/game/misc.lua')
-rw-r--r--builtin/game/misc.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index 7fa95742e..e3b7d82bc 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -14,6 +14,7 @@ local function update_timers(delay)
local timer = timers[index]
timer.time = timer.time - delay
if timer.time <= 0 then
+ core.set_last_run_mod(timer.mod_origin)
timer.func(unpack(timer.args or {}))
table.remove(timers, index)
sub = sub + 1
@@ -55,12 +56,22 @@ function core.after(time, func, ...)
"Invalid core.after invocation")
if not mintime then
mintime = time
- timers_to_add = {{time=time+delay, func=func, args={...}}}
+ timers_to_add = {{
+ time = time+delay,
+ func = func,
+ args = {...},
+ mod_origin = core.get_last_run_mod(),
+ }}
return
end
mintime = math.min(mintime, time)
timers_to_add = timers_to_add or {}
- timers_to_add[#timers_to_add+1] = {time=time+delay, func=func, args={...}}
+ timers_to_add[#timers_to_add+1] = {
+ time = time+delay,
+ func = func,
+ args = {...},
+ mod_origin = core.get_last_run_mod(),
+ }
end
function core.check_player_privs(name, privs)