lua-users home
lua-l archive

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


> privateData = setmetatable( {}, { __mode = 'kv' } )
>
> x = { }
> xprivate = { public = x }
> privateData[ x ] = xprivate
> 
> -- Now drop the references...
> 
> x = nil
> xprivate = nil
> 
> The values still live forever because of the reference from
> privateData even though nothing can ever reach those values.

That is not true. next(privateData) will return both 'x' and 'xprivate'.

-- Roberto