Re:Lua, a Misunderstood Language
by chmod775 on Friday January 15, 2021 @06:04PM
(#25797757)
Not only that, but starting at 0 just works mathematically better when doing stuff like dividing into round/ceil/floor or a modulo operation. If your index starts at 1 these can become really unintuitive. Depending on what you're doing you'll have to add/subtract 1 after/before operations a lot.
The only upside I'm aware of is that the 'length' of your array is now a valid index, which is mostly not very useful unless you want to iterate backwards.
The only upside I'm aware of is that the 'length' of your array is now a valid index, which is mostly not very useful unless you want to iterate backwards.