diff options
author | sanine-a <sanine.not@pm.me> | 2020-10-25 10:51:13 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-10-25 10:51:13 -0500 |
commit | 1a55ea2d22436359f8e11061e203cf9e8849a114 (patch) | |
tree | 4984cc1ded2473d313098cca31fa7401a745b2a9 /src/honey_lua.c | |
parent | 6162a18f445b89400be521fdeeb0d6a812a03c35 (diff) |
add honey_exit
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; +} |