From 2f8028ac9e0812cb6f3cbb08f0f419e4e717bd22 Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 1 Mar 2022 23:28:11 -0600 Subject: pop after creating window --- src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index e6311c2..a55dc6f 100644 --- a/src/main.c +++ b/src/main.c @@ -53,6 +53,7 @@ int main(int argc, char **argv) goto close; /* sorry */ } + /* ensure window exists */ if (!window.created) { lua_getglobal(L, "honey"); lua_getfield(L, -1, "window"); @@ -60,8 +61,10 @@ int main(int argc, char **argv) lua_pushinteger(L, 640); lua_pushinteger(L, 480); hs_call(L, 2, 0); + lua_pop(L, 2); } + /* load main callback functions */ int update = get_func(L, "update"); if (update) honey_info("honey.update: %s\n", lua_tostring(L, update)); else honey_info("honey.update: (nil)\n"); @@ -69,6 +72,7 @@ int main(int argc, char **argv) if (draw) honey_info("honey.draw: %s\n", lua_tostring(L, draw)); else honey_info("honey.draw: (nil)\n"); + /* main loop */ while(!glfwWindowShouldClose(window.window)) loop(L, update, draw); -- cgit v1.2.1