luaaA: add luaA_unregister()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e9916d34b6
commit
4e37a6cde2
13
luaa.h
13
luaa.h
|
@ -262,7 +262,7 @@ luaA_usemetatable(lua_State *L, int idxobj, int idxfield)
|
|||
/** Register an Lua object.
|
||||
* \param L The Lua stack.
|
||||
* \param idx Index of the object in the stack.
|
||||
* \param fct A luaA_ref address: it will be filled with the luaA_ref
|
||||
* \param ref A luaA_ref address: it will be filled with the luaA_ref
|
||||
* registered. If the adresse point to an already registered object, it will
|
||||
* be unregistered.
|
||||
* \return Always 0.
|
||||
|
@ -277,6 +277,17 @@ luaA_register(lua_State *L, int idx, luaA_ref *ref)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Unregister a Lua object.
|
||||
* \param L The Lua stack.
|
||||
* \param ref A reference to an Lua object.
|
||||
*/
|
||||
static inline void
|
||||
luaA_unregister(lua_State *L, luaA_ref *ref)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, *ref);
|
||||
*ref = LUA_REFNIL;
|
||||
}
|
||||
|
||||
/** Register a function.
|
||||
* \param L The Lua stack.
|
||||
* \param idx Index of the function in the stack.
|
||||
|
|
Loading…
Reference in New Issue