But each time I try I get to the part where I learn that array indices start at 1 and I get annoyed. Have we not learned anything since BASIC? Sigh.
But each time I try I get to the part where I learn that array indices start at 1 and I get annoyed. Have we not learned anything since BASIC? Sigh.
The lua users wiki is full of interesting ideas for tackling the basics in ways that leverage lua's simple flexibility.
It just bugs me that such an obvious wart exists in an otherwise very clean language.
("foreign" with regards to programming language.)
People who write off Lua because of indexing from 1, Python because of the significant whitespace, Lisp for its pares, etc. probably haven't gotten to the really interesting stuff yet.
In my experience 1-based indexing is not a problem when you're just writing Lua code. I've sometimes been frustrated when creating Lua bindings to C-modules which involved some kind of array access though.
In C, it's an offset into a typed block of memory, so 0 indexing makes sense. But lua does not deal directly with memory.