From 0d7810b333c0e1635bacb7e3eef793d07ff2c687 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 13 May 2018 17:19:14 -0700 Subject: [PATCH] Fix some issues with lovr.event.quit('restart'); --- src/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 42cbaa09..75a1c0e2 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,7 @@ int main(int argc, char** argv) { glfwSetErrorCallback(onGlfwError); lovrAssert(glfwInit(), "Error initializing GLFW"); + glfwSetTime(0); // arg lua_newtable(L); @@ -70,12 +71,9 @@ int main(int argc, char** argv) { emscripten_set_main_loop_arg(emscriptenLoop, (void*) L, 0, 1); return 0; #else - int top = lua_gettop(L); - while (lua_resume(L, 0) == LUA_YIELD) { - lua_settop(L, top); - } + while (lua_resume(L, 0) == LUA_YIELD) ; - int exitCode = luaL_optint(L, -1, 0); + int exitCode = lua_tonumber(L, -1); bool isRestart = lua_type(L, -1) == LUA_TSTRING && !strcmp(lua_tostring(L, -1), "restart"); lovrDestroy();