lua-users home
lua-l archive

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


Tony Finch wrote:
> On Thu, 9 Aug 2007, Paul Ducklin wrote:
>>> Lua's 1-based native indexing
>>> already annoys people
>> 
>> Errrr, which people exactly?
> 
> Dijkstra has some good arguments:
> 
> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

In this paper he says that 0-based indexing is better if you use
convention 'a' (loops of the form 'for (i=0; i<N; ++i)'). Lua uses
convention 'c' (loops of the form 'for (i=1; i<=N; ++i)', or in Lua 'for
i=1,N do'), so 1-based indexing is more suited to Lua.