lua-users home
lua-l archive

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

On Fri, Sep 23, 2011 at 6:52 PM, Gé Weijers <> wrote:
> No it's not. You created a nested table, and the 'inner' table that
> TableMain.B refers to will be collected sometime after you assign 'nil' to
> TableMain.B, because there is no way to get to that table anymore. And
> that's exactly the criterion used be the garbage collector to decide whether
> the table can be removed.

In fact, when you do 'TableMain = {}' , you are doing '_G["TableMain"]
= {}' .  So, when you assign nil, it is going to be garbage collected
(someday)  just like 'TableMain.B = nil'.