diff options
Diffstat (limited to 'src/glfw/window.c')
-rw-r--r-- | src/glfw/window.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/glfw/window.c b/src/glfw/window.c index 0199fb0..5922dde 100644 --- a/src/glfw/window.c +++ b/src/glfw/window.c @@ -88,6 +88,12 @@ int glfwCreateWindow_bind(lua_State *L) GLFWwindow ** window = create_window(L); *window = glfwCreateWindow(width, height, title, *monitor, *share); + if (*window == NULL) { + int code; + const char *err; + code = glfwGetError(&err); + return luaL_error(L, "failed to create window: %s [code %d]", err, code); + } configure_window(window); return 1; } @@ -113,7 +119,7 @@ int glfwWindowShouldClose_bind(lua_State *L) int glfwSetWindowShouldClose_bind(lua_State *L) { GLFWwindow ** window = luaL_checkudata(L, 1, glfw_window_tname); - int value = luaL_checkinteger(L, 2); + int value = lua_toboolean(L, 2); glfwSetWindowShouldClose(*window, value); return 0; } |