lua-users home
lua-l archive

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


On 2/4/11, Andrew Lentvorski <bsder@allcaps.org> wrote:
> 1) I lose all benefit of being compatible with "real" Lua.  That's
> significant loss.

If the task at hand benefits from 0-based arrays...

> 2) The length operator "#" enshrined 1-based arrays as language law even
> if it was only convention prior.

#t follows __len in 5.2 .

> 3) The fact that I have to write a numeric "for" to iterate in this day
> and age ticks me off. :)

I see your point, but I believe that next (and a companion __next)
makes more sense has a general purpose overloadable iterator instead
of ipairs/pairs; the latter could easily be implemented in pure Lua on
top of a counter/next.


Besides, I was just ranting against the "1-based arrays is a
deal-breaker" comment: my point was that the only thing that can't be
changed in Lua code is the table constructor and even that has an
idiomatic solution.