lua-users home
lua-l archive

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


For example, what I want is something like:

a = { ....whatever ... }
b = { __gc = function ...finalizer stuff... end }
setmetatable(a,b)

Then when "a" is collected it will run the __gc function in the metatable.  That doesn't seem to work currently.   Or how to I get this type of functionality?  I have a table that has some external state information that needs to be cleaned up when the table is destroyed.  Is my only choice to manually call some sort of cleanup function before killing the table?

Thanks

--
// Chris