mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 18:09:18 +02:00
write lua errors to errorlog
This commit is contained in:
10
lua.cpp
10
lua.cpp
@@ -31,8 +31,10 @@ lua::~lua()
|
||||
|
||||
void lua::interpret(std::string file)
|
||||
{
|
||||
if (luaL_dofile(state, file.c_str()))
|
||||
throw std::runtime_error(lua_tostring(state, -1));
|
||||
if (luaL_dofile(state, file.c_str())) {
|
||||
char *str = lua_tostring(state, -1);
|
||||
ErrorLog(std::string(str), logtype::lua);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: we cannot throw exceptions in callbacks
|
||||
@@ -41,7 +43,7 @@ void lua::interpret(std::string file)
|
||||
int lua::atpanic(lua_State *s)
|
||||
{
|
||||
std::string err(lua_tostring(s, -1));
|
||||
ErrorLog(err);
|
||||
ErrorLog(std::string(err), logtype::lua);
|
||||
#ifdef _WIN32
|
||||
MessageBox(NULL, err.c_str(), "MaSzyna", MB_OK);
|
||||
#endif
|
||||
@@ -52,7 +54,7 @@ int lua::openffi(lua_State *s)
|
||||
{
|
||||
if (luaL_dostring(s, lua_ffi))
|
||||
{
|
||||
ErrorLog(std::string(lua_tostring(s, -1)));
|
||||
ErrorLog(std::string(lua_tostring(s, -1)), logtype::lua);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user