3 ms·
Yes, ipairs is idiomatic, but that doesn't matter here because ipairs doesn't return the 0 index. > x = {} > x[0] = 2 > x[1] = 3 > for i, v in ipairs(x
by LewisJEllis 11y ago
Yes, ipairs is idiomatic, but that doesn't matter here because ipairs doesn't return the 0 index.
> x = {}
> x[0] = 2
> x[1] = 3
> for i, v in ipairs(x) do print(i, v) end
1 3
> x[2] = 4
> for i, v in ipairs(x) do print(i, v) end
1 3
2 4
- qwertyuiop924 11y agoNo, what I mean is that it's not idiomatic to access lua "arrays" by index.
- fit2rule 11y agoThe only requirement is the Lua developer knowing how to use a Lua table for anything they need.