Skip to content
Snippets Groups Projects
Commit 5ef78cd8 authored by Perttu Ahola's avatar Perttu Ahola
Browse files

Make Lua error output in log clearer

parent 9101b680
No related branches found
No related tags found
No related merge requests found
......@@ -96,10 +96,13 @@ bool script_load(lua_State *L, const char *path)
int ret = luaL_loadfile(L, path) || lua_pcall(L, 0, 0, errorhandler);
if(ret){
errorstream<<"Failed to load and run script from "<<path<<":"<<std::endl;
errorstream<<"[LUA] "<<std::endl;
errorstream<<"[LUA] "<<lua_tostring(L, -1)<<std::endl;
errorstream<<"[LUA] "<<std::endl;
errorstream<<"========== ERROR FROM LUA ==========="<<std::endl;
errorstream<<"Failed to load and run script from "<<std::endl;
errorstream<<path<<":"<<std::endl;
errorstream<<std::endl;
errorstream<<lua_tostring(L, -1)<<std::endl;
errorstream<<std::endl;
errorstream<<"=======END OF ERROR FROM LUA ========"<<std::endl;
lua_pop(L, 1); // Pop error message from stack
lua_pop(L, 1); // Pop the error handler from stack
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment