}
err_msg += err_descr;
+ if (pcall_result == LUA_ERRMEM) {
+ err_msg += "\nCurrent Lua memory usage: "
+ + itos(lua_gc(L, LUA_GCCOUNT, 0) >> 10) + " MB";
+ }
+
throw LuaError(err_msg);
}
// Stack now looks like this:
// ... <error handler> <run_callbacks> <table> <mode> <arg#1> <arg#2> ... <arg#n>
- script_error(L, lua_pcall(L, nargs + 2, 1, errorhandler), fxn);
+ int result = lua_pcall(L, nargs + 2, 1, errorhandler);
+ if (result != 0)
+ script_error(L, result, fxn);
lua_remove(L, -2); // Remove error handler
}
std::string value = g_settings->get("deprecated_lua_api_handling");
if (value == "log") {
dolog = true;
- }
- if (value == "error") {
+ } else if (value == "error") {
dolog = true;
doerror = true;
}
std::string script = getServer()->getBuiltinLuaPath() + DIR_DELIM + "init.lua";
if (!loadScript(script)) {
errorstream
- << "AsyncWorkderThread execution of async base environment failed!"
+ << "AsyncWorkerThread execution of async base environment failed!"
<< std::endl;
abort();
}