lua-users home
lua-l archive

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

That is really interesting.  I've used metatables for extending LUA syntax to
C datatypes but I didn't realize you could attach garbage collector actions
to them.  This approach is quite interesting.  It doesn't directly solve my
problem in that it doesn't expose the C pointers stored in LUA data
structures to the gc in C.   Thus the C garbage collector will still see the
C objects stored in LUA as unreachable.  However what your solution does do
is to allow the LUA gc to automatically deallocate objects from C using say
the standard malloc and free approach.  That's pretty close to having a
garbage collector, though all the destructors will have to be written
explicitly and on the C side of things the C garbage collector will have to
be dropped or disabled.
View this message in context:
Sent from the Lua - General forum at