lua-users home
lua-l archive

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


Soni "They/Them" L. wrote
> hi, so, a lot of ppl won't use Lua because Lua uses 1-based indexing. 
> well, other languages use 0-based indexing. but, what if we had neither?

Use or not to use some particular language only because of array indexing is
absolutely stupid.

Not all the languages have 'native' hardware pointers and thus pointer
arithmetic, with the array index being an offset from the array address, but
not actually index.
e.g. Wolfram Mathematica, Mathlab, R, Julia ...

0-based arrays have last element, which is array[LENGTH-1], instead of
array[LENGTH]. what's the difference where to add/subtract this 1?

ppl could also use 0-based arrays if they like
for i=0,#array-1 do print(array[i]) end

imho nothing to fix here.



--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html