forked from mirror/openmw-tes3mp
[Server] Add special error handler for Sol back in, but only for Windows
This commit is contained in:
parent
14d47213ef
commit
378d30834b
1 changed files with 11 additions and 0 deletions
|
@ -80,6 +80,17 @@ LuaState::LuaState()
|
||||||
configEnv = sol::environment(*lua, sol::create, lua->globals());
|
configEnv = sol::environment(*lua, sol::create, lua->globals());
|
||||||
lua->set("Config", configEnv); // plain global environment for mod configuration
|
lua->set("Config", configEnv); // plain global environment for mod configuration
|
||||||
|
|
||||||
|
// Enable a special Sol error handler for Windows, because exceptions aren't caught properly
|
||||||
|
// in main.cpp for it
|
||||||
|
#if defined(SOL_SAFE_FUNCTIONS) && defined(WIN32)
|
||||||
|
lua->set_function("ErrorHandler", [](sol::object error_msg) {
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, ("Lua: " + error_msg.as<string>()).c_str());
|
||||||
|
});
|
||||||
|
|
||||||
|
sol::reference errHandler = (*lua)["ErrorHandler"];
|
||||||
|
sol::protected_function::set_default_handler(errHandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
sol::table Constants = lua->create_named_table("Constants");
|
sol::table Constants = lua->create_named_table("Constants");
|
||||||
|
|
||||||
Constants.set_function("getAttributeCount", []() {
|
Constants.set_function("getAttributeCount", []() {
|
||||||
|
|
Loading…
Reference in a new issue