3 ms·
Lua. However, you are allowed to use 0 based indexing as well -- but the # length operator and table.remove() will not work correctly.
by russellsprouts 13y ago
Lua. However, you are allowed to use 0 based indexing as well -- but the # length operator and table.remove() will not work correctly.
- aiiane 13y agoAlso loops will potentially behave awkwardly, due to the table having shifted into dictionary-esq indexing.
- anonymoushn 13y agoThis won't be a big deal. The 0 key will be in the hash part, and the 1-#t keys will be in the array part. The language doesn't expose the distinction, so the loop-related awkwardness is limited to a tiny performance hit.
- ufo 13y agoIf you try to use ipairs to iterate then it will skip the zero-th index but if you use a numeric for loop (for i=0,N do) then you should be fine.