[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: Eric Scouten <scouten@...>
- Date: Mon, 11 Sep 2006 10:58:50 -0700
On 11 Sep 2006, at 10:50, Dave Nichols wrote:
I disagree, why should an integer index be any more significant
than a name?
I think a missing index should be a syntax error as it is now.
Use table.insert instead, it defaults to #+1
The problem with this is that table.insert means a function call (*),
whereas the syntax I proposed would be inline. In tight loops, this
makes a significant difference.
* It also means an extra table lookup unless you do something like
local tinsert = table.insert
-- Inside the loop
tinsert( table, key, value )