summaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-12-03 02:10:32 -0600
committersanine-a <sanine.not@pm.me>2020-12-03 02:10:32 -0600
commite767e1ff9d81f8a76196caab91d9b6b4bbe0b30e (patch)
tree25a058779bcd4de00ce04ccf6cb0157cfba32611 /src/input.c
parentf417d2b047369cac234c471ef37ab8281181d69f (diff)
rewrite demo
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/input.c b/src/input.c
index 3b0b286..ca5fc05 100644
--- a/src/input.c
+++ b/src/input.c
@@ -194,8 +194,8 @@ int honey_key_bind(lua_State* L)
int choice = honey_lua_parse_arguments
(L, 2,
- 2, HONEY_INTEGER, &key, HONEY_FUNCTION,
- 3, HONEY_INTEGER, &key, HONEY_FUNCTION, HONEY_ANY);
+ 2, HONEY_INTEGER, &key, HONEY_FUNCTION, NULL,
+ 3, HONEY_INTEGER, &key, HONEY_FUNCTION, NULL, HONEY_ANY, NULL);
lua_pushvalue(L, 2);
int callback = luaL_ref(L, LUA_REGISTRYINDEX);
@@ -282,16 +282,19 @@ int honey_mouse_set_mode(lua_State* L)
int honey_mouse_movement_bind(lua_State* L)
{
- honey_lua_parse_arguments
- (L, 1,
- 2, HONEY_FUNCTION, HONEY_ANY);
+ int choice = honey_lua_parse_arguments
+ (L, 2,
+ 1, HONEY_FUNCTION, NULL,
+ 2, HONEY_FUNCTION, NULL, HONEY_ANY, NULL);
honey_mouse_movement_unbind(L); /* avoid memory leaks! */
lua_pushvalue(L, 1);
honey_mouse_movement_callback_ref = luaL_ref(L, LUA_REGISTRYINDEX);
- lua_pushvalue(L, 2);
- honey_mouse_movement_callback_data_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ if (choice == 1) {
+ lua_pushvalue(L, 2);
+ honey_mouse_movement_callback_data_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ }
return 0;
}