diff options
Diffstat (limited to 'src/honey_lua.c')
-rw-r--r-- | src/honey_lua.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/honey_lua.c b/src/honey_lua.c index 4dd0667..1d1375f 100644 --- a/src/honey_lua.c +++ b/src/honey_lua.c @@ -273,3 +273,20 @@ int honey_lua_pcall(lua_State* L, int nargs, int nret) return result; } +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +int honey_exit(lua_State* L) +{ + if (honey_window_info_ref == LUA_NOREF || + honey_window_info_ref == LUA_REFNIL) { + lua_pushstring(L, "Window information is not set!"); + lua_error(L); + } + + lua_rawgeti(L, LUA_REGISTRYINDEX, honey_window_info_ref); + honey_window_information* info = lua_touserdata(L, -1); + lua_pop(L, 1); + + glfwSetWindowShouldClose(info->window, true); + return 0; +} |