[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: Diego Nehab <diego@...>
- Date: Tue, 12 Sep 2006 12:53:37 -0400 (EDT)
Hi,
To make it clear for me, it would have to be something crazy like:
p[end+1] = value
...in which case end would simply be syntactic sugar for 'the length of
the current table'.
This starts looking a lot like Matlab. :)
Although I am not terribly against adding new syntax to Lua,
I think that the benefits of this specific new syntax are
not worth it.
It appears to be only 25% improvement, so most tasks won't
get killed by using table.insert. For the tasks that *will*
get killed, you have two options. Use the
big_table_name[#big_table_name + 1] = value and live with
it, or save it into a local 't' right before you start using
your big_table_name like crazy.
Regards,
Diego.