lua-users home
lua-l archive

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


On Wed, Mar 14, 2018 at 1:04 AM, Russell Haley <russ.haley@gmail.com> wrote:
>> u = table.move(t,1,#t,1,{})
>> for i,v in pairs(u) do print(i,v) end
> 1       one
> 2       two
> 3       four
> 4       nil
> 5       five
>> #t
> 5
>> t[4] = undef
>> for i,v in pairs(t) do print(i,v) end
> 1       one
> 2       two
> 3       four
> 5       five
>> #t
> 3  --<<<<<< I Expected 4 here?
>>

This is expected. You have a table with a hole in it -- and you
explicitly constructed it that way. The length of the sequence part of
t is, in fact, 3.

/s/ Adam