Fix some issues with lovr.event.quit('restart');

This commit is contained in:
bjorn 2018-05-13 17:19:14 -07:00 committed by bjornbytes
parent 781a5a7688
commit 0d7810b333
1 changed files with 3 additions and 5 deletions

View File

@ -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();