forked from mirror/openmw-tes3mp
[Server] Use custom Lua error handler not only on Windows
For some reason sol's default error handler does not wroking properly
This commit is contained in:
parent
71c921faa7
commit
bd7082f57e
1 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
#if defined(SOL_SAFE_FUNCTIONS) && defined(WIN32)
|
#if defined(SOL_SAFE_FUNCTIONS)
|
||||||
inline int errHandler(lua_State *L)
|
inline int errHandler(lua_State *L)
|
||||||
{
|
{
|
||||||
string msg = "An unknown error has triggered the default error handler";
|
string msg = "An unknown error has triggered the default error handler";
|
||||||
|
@ -107,7 +107,7 @@ LuaState::LuaState()
|
||||||
|
|
||||||
// Enable a special Sol error handler for Windows, because exceptions aren't caught properly
|
// Enable a special Sol error handler for Windows, because exceptions aren't caught properly
|
||||||
// in main.cpp for it
|
// in main.cpp for it
|
||||||
#if defined(SOL_SAFE_FUNCTIONS) && defined(WIN32)
|
#if defined(SOL_SAFE_FUNCTIONS)
|
||||||
lua_CFunction f = sol::c_call<decltype(&errHandler), &errHandler>;
|
lua_CFunction f = sol::c_call<decltype(&errHandler), &errHandler>;
|
||||||
sol::protected_function::set_default_handler(sol::object(lua->lua_state(), sol::in_place, f));
|
sol::protected_function::set_default_handler(sol::object(lua->lua_state(), sol::in_place, f));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue