From de2fa7938758ff83cabf06baf4c0ac7a230e78bf Mon Sep 17 00:00:00 2001 From: sanine-a Date: Sat, 24 Oct 2020 22:09:34 -0500 Subject: add more window functions and clean up window info access --- src/honey.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/honey.c') diff --git a/src/honey.c b/src/honey.c index cfc5bc7..5cf960e 100644 --- a/src/honey.c +++ b/src/honey.c @@ -65,18 +65,17 @@ bool honey_setup(lua_State** L) if (!honey_setup_window(*L)) return false; - - lua_getfield(*L, -1, "internal"); - honey_window_information* info = lua_touserdata(*L, -1); - lua_pop(*L, 1); lua_setfield(*L, -2, "window"); honey_setup_input(*L); - glfwSetKeyCallback(info->window, default_honey_keyboard_callback); lua_setfield(*L, -2, "input"); lua_setglobal(*L, "honey"); + lua_rawgeti(*L, LUA_REGISTRYINDEX, honey_window_info_ref); + honey_window_information* info = lua_touserdata(*L, -1); + glfwSetKeyCallback(info->window, default_honey_keyboard_callback); + return true; } -- cgit v1.2.1