From 2b04ab874d75711bc021a0cd8dc7fca68f4e6929 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 11 Aug 2015 22:27:54 -0400 Subject: SAPI: Track last executed mod and include in error messages --- builtin/game/item.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'builtin/game/item.lua') diff --git a/builtin/game/item.lua b/builtin/game/item.lua index d25f4eff0..6628a4081 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -479,6 +479,15 @@ function core.node_dig(pos, node, digger) -- Run script hook local _, callback for _, callback in ipairs(core.registered_on_dignodes) do + local origin = core.callback_origins[callback] + if origin then + core.set_last_run_mod(origin.mod) + --print("Running " .. tostring(callback) .. + -- " (a " .. origin.name .. " callback in " .. origin.mod .. ")") + else + --print("No data associated with callback") + end + -- Copy pos and node because callback can modify them local pos_copy = {x=pos.x, y=pos.y, z=pos.z} local node_copy = {name=node.name, param1=node.param1, param2=node.param2} -- cgit v1.2.3