lua-users home
lua-l archive

Re: table.new in 5.3?

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


Sean Conner wrote:
> 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.
Best regards,
David Kolf

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