summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_env.cpp
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 /src/script/lua_api/l_env.cpp
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 'src/script/lua_api/l_env.cpp')
-rw-r--r--src/script/lua_api/l_env.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 48c46c079..9d1936769 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -68,6 +68,8 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
FATAL_ERROR("");
lua_remove(L, -2); // Remove registered_abms
+ scriptIface->setOriginFromTable(-1);
+
// Call action
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, "action");
@@ -78,7 +80,9 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
lua_pushnumber(L, active_object_count);
lua_pushnumber(L, active_object_count_wider);
- PCALL_RESL(L, lua_pcall(L, 4, 0, errorhandler));
+ int result = lua_pcall(L, 4, 0, errorhandler);
+ if (result)
+ scriptIface->scriptError(result, "LuaABM::trigger");
lua_pop(L, 1); // Pop error handler
}