keybinding: register fct with dedicated fct

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-17 11:58:09 +02:00
parent 277aec7fcf
commit f098790224
1 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,8 @@ static struct {
keybinding_array_t by_sym; keybinding_array_t by_sym;
} keys_g; } keys_g;
static void keybinding_delete(keybinding_t **kbp) static void
keybinding_delete(keybinding_t **kbp)
{ {
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, (*kbp)->fct); luaL_unref(globalconf.L, LUA_REGISTRYINDEX, (*kbp)->fct);
p_delete(kbp); p_delete(kbp);
@ -333,7 +334,7 @@ luaA_keybinding_new(lua_State *L)
/* get the last arg as function */ /* get the last arg as function */
k = p_new(keybinding_t, 1); k = p_new(keybinding_t, 1);
__luaA_keystore(k, key); __luaA_keystore(k, key);
k->fct = luaL_ref(L, LUA_REGISTRYINDEX); luaA_registerfct(L, &k->fct);
len = lua_objlen(L, 2); len = lua_objlen(L, 2);
for(i = 1; i <= len; i++) for(i = 1; i <= len; i++)
@ -355,7 +356,6 @@ static int
luaA_keybinding_add(lua_State *L) luaA_keybinding_add(lua_State *L)
{ {
keybinding_t **k = luaA_checkudata(L, 1, "keybinding"); keybinding_t **k = luaA_checkudata(L, 1, "keybinding");
keybinding_register_root(*k); keybinding_register_root(*k);
return 0; return 0;
} }