View Single Post
09-09-14, 09:06 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote