summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-03-01 23:28:11 -0600
committersanine <sanine.not@pm.me>2022-03-01 23:28:11 -0600
commit2f8028ac9e0812cb6f3cbb08f0f419e4e717bd22 (patch)
tree0a5e9bd50816a5a8f9bdd7d58f8d95db827e359d
parent82cf18b9163f86e4d0a1cd999d4815cc3f85a3fd (diff)
pop after creating window
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
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);