2) Yes, I do use Google, I just wanted to get a "Good" answer so to say..
Well say we have this table
local t = {
12,
3,
5,
hello = 'hello',
4,
world = 'world',
10,
key = 'something',
}
now if we use a standard incremental for loop like this
for i = 1, #t do
print(i..' : '..t[i])
end
we get this output
1 : 12
2 : 3
3 : 5
4 : 4
5 : 10
now if we use a generic for loop, pairs
for k,v in pairs(t) do
print(k..' : '..v)
end
we get this output
1 : 12
2 : 3
3 : 5
4 : 4
5 : 10
key : something
world : world
hello : hello
now if we use a generic for loop, ipairs
for i,v in ipairs(t) do
print(i..' : '..v)
end
we get this output
1 : 12
2 : 3
3 : 5
4 : 4
5 : 10
notice how the ipairs is the same as a standard incremental for loop, and can only access indexed values… well you can use either, but using the standard incremental for loop was decided (in a massive discussion months ago) is much more efficient… now as you can also see the pairs loop lets you access indexed pairs as well as key/value pairs…