4 ms·
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
by ams6110 13y ago
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.
- SomeCallMeTim 13y ago...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.
- justincormack 13y agoYou can fix some libraries by using ipairs. But not all of course.