3 ms·
I was with you up to the last paragraph. Lua uses 1-based indexing because it started as a data description language, and data tends to use 1-based indexing.
by samatman 6y ago
I was with you up to the last paragraph.
Lua uses 1-based indexing because it started as a data description language, and data tends to use 1-based indexing.
It evolved to where the primary use case is at odds with this origin. I work with Lua every day and consider the indexing convention to be a genuine flaw. But it's useful to know where that came from, because it wasn't a mistake.
- CountSessine 6y agoThat makes a lot sense. History is a path-dependent function, I guess. Interesting that it was a data description language - in that context, 1-based indexing really would be called for, although maybe flexible indexing like Pascal’s would be even better.