Lua empty stack trace, and empty error message
Jerboa-app opened this issue · comments
Fixed in #96
- fixed the empty stack trace via this https://stackoverflow.com/questions/30021904/lua-set-default-error-handler
- empty error message was just unimplemented
Requires a debug function to be inserted before calling pcall, so instead of lua_dofile
we do...
bool runFile(std::string file)
{
if (luaIsOk())
{
lastCommandOrProgram = file;
lastStatus = luaL_loadfile(lua, file.c_str());
// location of custom error handler
int epos = lua_gettop(lua);
// push the custom handler
lua_pushcfunction(lua, traceback);
lua_insert(lua, epos);
// run the file passing in the handler
lastStatus = lastStatus || lua_pcall(lua, 0, LUA_MULTRET, epos);
lua_remove(lua, epos);
return handleErrors();
}
return false;
}