]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_env.cpp
SAPI: Track last executed mod and include in error messages
[dragonfireclient.git] / src / script / lua_api / l_env.cpp
index 48c46c07999e1d0e469980e7a917ec7d83b0806d..9d1936769192d03c8f03dbcc59297d7541ed94ad 100644 (file)
@@ -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
 }