lua-users home
lua-l archive

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


2007/9/21, David Burgess <dburgess@gmail.com>:
> If I create a metatable (lua_createtable()) and use lua_setmetable()
> to associate the metatable with a table and do not put the metatable
> in the registry with luaL_newmetatble(), am I right in thinking that
> because the metatable is is referenced by the table that the metatable
> will not be collected?
> And when I delete the table, the metatable will be collected because
> it is no longer referenced?

Yes. Being the metatable of another object prevent a table from being collected.