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
|
@ -67,6 +67,9 @@ void ScriptApiServer::getAuthHandler()
|
|||
lua_pop(L, 1);
|
||||
lua_getfield(L, -1, "builtin_auth_handler");
|
||||
}
|
||||
|
||||
setOriginFromTable(-1);
|
||||
|
||||
lua_remove(L, -2); // Remove core
|
||||
if (lua_type(L, -1) != LUA_TTABLE)
|
||||
throw LuaError("Authentication handler table not valid");
|
||||
|
@ -133,7 +136,7 @@ bool ScriptApiServer::on_chat_message(const std::string &name,
|
|||
// Call callbacks
|
||||
lua_pushstring(L, name.c_str());
|
||||
lua_pushstring(L, message.c_str());
|
||||
script_run_callbacks(L, 2, RUN_CALLBACKS_MODE_OR_SC);
|
||||
runCallbacks(2, RUN_CALLBACKS_MODE_OR_SC);
|
||||
bool ate = lua_toboolean(L, -1);
|
||||
return ate;
|
||||
}
|
||||
|
@ -146,6 +149,6 @@ void ScriptApiServer::on_shutdown()
|
|||
lua_getglobal(L, "core");
|
||||
lua_getfield(L, -1, "registered_on_shutdown");
|
||||
// Call callbacks
|
||||
script_run_callbacks(L, 0, RUN_CALLBACKS_MODE_FIRST);
|
||||
runCallbacks(0, RUN_CALLBACKS_MODE_FIRST);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue