Re:Why Python uses 0-based indexing. It's because of slices
by ams6110 on Wednesday October 23, 2013 @09:33PM
(#6602908)
One thing to remember is that Lua arrays are 1-based by convention, not requirement, since they are really just tables indexed by integers. So you can have zero-based arrays in Lua, but you'll be making life difficult for yourself as the convention, the libraries, and array literals will all want to give you 1-based arrays.
[ Parent
| on HN ]
Re:Why Python uses 0-based indexing. It's because of slices
by SomeCallMeTim on Wednesday October 23, 2013 @10:10PM
(#6603014)
...and if you're using LuaJIT, 0-based arrays will even be optimized appropriately (i.e., array[0] will be stored internally in the array rather than in the hash).
But you'll still be fighting with the libraries and array literals, as you say.
Re:Why Python uses 0-based indexing. It's because of slices
by justincormack on Thursday October 24, 2013 @03:24AM
(#6603821)
You can fix some libraries by using ipairs. But not all of course.