lua-users home
lua-l archive

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


hello, PA <petite.abeille@gmail.com>.

On Fri, 3 Aug 2007 12:40:58 +0200
PA <petite.abeille@gmail.com> wrote:

>  >       1       nil
>  >       2       a
>  >       3       nil
> 
> Ok... 3 arguments... in the right order... now lets try to insert an 
> additional value:
> 
> table.insert( aList, 'first' )
> aList.n = aList.n + 1
> 
>  >       1       first
>  >       2       a
>  >       3       nil
>  >       4       nil
> 
> Oh, no! 4 mangled arguments :(
Lua 5.1, right? table.insert doesn't work right on sparse tables,
'cause it not use xxx.n anymore. you should emulate with your code or
don't use nils in arrays.