lua-users home
lua-l archive

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


I've discovered that userdata can be formed from a pointer to memory coming from 
either lua_newuserdata, or malloc/&static as usual.  Is the distinction merely that 
the first will be garbage collected (and luaM_free() will be called on it) and the 
second will not?

Even if that is so, how do I get a callback into my embedding program to call the 
"destructor" at the time of garbage collection for a userdata that I've created?  
The objects I intend to create in my program will be numerous, and use a lot of 
system resources (including a seperate thread), so I need for them to be recycled 
whenever possible.

Is there something I am missing, or is Lua simply not a state where it can solve my 
problem?


--
Paul Hsieh
qed@pobox.com