mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
SAPI: Track last executed mod and include in error messages
This commit is contained in:
parent
738fbc66d0
commit
2b04ab874d
19 changed files with 231 additions and 45 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue