[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tinsert()'s default pos?
- From: "John Belmonte" <jvb@...>
- Date: Thu, 26 Apr 2001 17:54:10 +0900
Luiz Henrique de Figueiredo wrote:
> >I know there is a restriction when it come to string index (i.e. they
> >start at 1) but there is no such restriction on tables, so why does
> >tinsert not start at index 0?
>
> If you really want to start with zero, try
>
> t={n=-1}
> tinsert( t, "A" )
> tinsert( t, "B" )
> tinsert( t, "C" )
Do we really want to encourage this kind if thing? Field n is supposed to
be the list length, not the index of the tail of the list. While the
current implementation may have this behavior, it's not described by the
reference manual. Thinking about the existence of alternate Lua
implementations someday, things like this will make it all the more
difficult.
Regards,
-John