mirror of
https://git.shylie.info/shylie/glerminal.git
synced 2024-11-12 21:10:04 +00:00
Improve lua error messages
This commit is contained in:
parent
da1f32a014
commit
6444654f42
@ -112,7 +112,7 @@ namespace
|
||||
{
|
||||
const char* error_message = lua_tostring(L, -1);
|
||||
|
||||
luaL_traceback(L, L, error_message, 0);
|
||||
luaL_traceback(L, L, error_message, 1);
|
||||
|
||||
const char* err = lua_tostring(L, -1);
|
||||
|
||||
@ -215,13 +215,24 @@ int main(int argc, char** argv)
|
||||
luaL_newlib(L, lglerminal_methods);
|
||||
lua_setglobal(L, "glerminal");
|
||||
|
||||
if (luaL_dofile(L, "main.lua") != LUA_OK)
|
||||
lua_pushcfunction(L, message_handler);
|
||||
const int handler = lua_gettop(L);
|
||||
if (luaL_loadfile(L, "main.lua") != LUA_OK)
|
||||
{
|
||||
const char* str = lua_tostring(L, -1);
|
||||
std::cout << str << std::endl;
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
glerminal_run(init, mainloop, pressed, released);
|
||||
else if (lua_pcall(L, 0, LUA_MULTRET, handler) != LUA_OK)
|
||||
{
|
||||
const char* str = lua_tostring(L, -1);
|
||||
std::cout << str << std::endl;
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
glerminal_run(init, mainloop, pressed, released);
|
||||
}
|
||||
|
||||
lua_close(L);
|
||||
|
||||
|
@ -296,6 +296,7 @@ namespace glerminal
|
||||
|
||||
glfwSwapInterval(0);
|
||||
glfwSwapBuffers(m_window);
|
||||
glBlitNamedFramebuffer(m_screen_framebuffer, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
glfwSwapInterval(1);
|
||||
glfwSwapBuffers(m_window);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user