lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I've got some C functions that take callback which has a void* pointer
for programmer-use. The technique I've been using is making a little
struct that holds the lua_State* and an int, which I store the return
value of luaL_ref'ing the given function. Then inside the C callback,
I take the Lua state and lua_rawgeti the function out of

But this seems very cumbersome and awkward. (Plus it means my function
won't be garbage-collected until I luaL_unref it out of there, but I'm
not sure that can be solved without making use of an explicit
"unregister" method for this C callback). Is there a better way to do
this that is less cumbersome and awkward? Thanks.