lua-users home
lua-l archive

Re: weak tables

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


On Wed, 9 Jan 2002, Ignacio Castaño wrote:
> Could someone explain the difference between tables with 'weak keys', 'weak
> values' and both?
Consider the following table:
a = {
 [{}] = 10,
 [20] = {},
}
If a has weak keys, only the first entry will be removed in a GC cicle.
If a has weak values, only the second entry will be removed in a GC cicle.
If a has both weaks, both entries will be removed.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /