That person is saying "for i = 1, #table do" and "for k, v in ipairs(table) do" are basically the same, with the first being slightly more performant. If you had a table that looked like this:
Lua Code:
{
firstFrame = PlayerFrame,
secondFrame = FocusFrame,
thirdFrame = TargetFrame
}
or
Lua Code:
{PlayerFrame, nil, FocusFrame, TargetFrame}
then you would need to use pairs, since ipairs will only iterate over numerical indexes (starting at 1) up to a nil value.
In the case of the second example,
Lua Code:
for k,v in ipairs({PlayerFrame, nil, FocusFrame, TargetFrame}) do
print(k, v)
end
will output
while
Lua Code:
for k,v in pairs({PlayerFrame, nil, FocusFrame, TargetFrame}) do
print(k, v)
end
will output
Code:
1, table:...
3, table:...
4, table:...