[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua, LuaJIT2 and differences with the length operator
- From: Leo Razoumov <slonik.az@...>
- Date: Tue, 4 Jan 2011 09:13:29 -0500
On Tue, Jan 4, 2011 at 09:07, Axel Kittenberger <firstname.lastname@example.org> wrote:
>> table.insert uses the same #len operator (aux_getn to be exact) and
>> will gladly insert your new value into the first available hole.
> a) if by the "first available" you do not mean the lowest index
> (otherwise again someone following into this trap? :-), but the first
> showing up on binary search, then its true.
> b) it might or might not shift indexes after the hole:
I was responding to a comment by Dirk who suggested to use
table.insert to append to the end of an array.
I simply wanted to point out that table.insert(t,v) suffers from the
same problems as t[#t+1]=v
Yes, "first available hole" should be replaced by "first found hole".
It does make a difference.