[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.new in 5.3?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 24 Nov 2013 06:21:49 -0200
> > Given:
> >
> > t = { 1 , 2 , 3 , ... }
> >
> > What's the difference between
> >
> > t = {}
> >
> > and
> >
> > table.clear(t)
> >
> > -spc (Curious about this ... )
>
> There might be other references to the table.
>
> t = { ... }
> a = t
>
> table.clear(t) --> a and t are still referencing the same table, which
> is now cleared.
>
> t = {} --> t got a new empty table, a has still the old table with all
> the values.
Moreover, table.clear should be able to release the memory used by the table
immediately, independent of the GC.
-- Roberto