3 ms·
Lua: array indexing starting at 1 (and interoperating with C is one of the main purposes of the language)
by hxa7241 18y ago
Lua: array indexing starting at 1 (and interoperating with C is one of the main purposes of the language)
- silentbicycle 18y agoSee also: (http://lua-users.org/wiki/CountingFromOne http://lua-users.org/wiki/CountingFromOne) There are arguments for doing it either way, but making indexing incompatible with the language in which it is expected to embed in is just rude.
- silentbicycle 18y agoWhich really is too bad, by the way - the language designers seem to have done a brilliant job of shrugging off potential design warts otherwise. It's a very clean language.