Even better on an indexed table (and
much faster than either
pairs or
next):
Code:
for i = 1, #t do
local v = t[i]
-- do stuff here
end
Using
ipairs is never necessary. It doesn't do anything the above method doesn't do, but it is much slower. I don't even know why
ipairs exists.