ipairs() is for tables where the keys are type 'number', start at 1 and increase by 1 on the next element
the elements don't have to be added to the table in key order
local Table = { 'a', 'b', 'c' }
local Table = { [1]='a', [2]='b', [3]='c' }
local Table = {}
Table[1] = 'a'
Table[2] = 'b'
Table[3] = 'c'
local String = table.concat(Table, " ")
local Table = { unpack(Table) }
for i,v in ipairs(Table) do
end
pairs() is for when the above doesn't apply, the keys can be any type lua supports, it will loop around all the elements in the table, but they are in a random order
local Table = { 'key'='a', 'key2'='b', 'key3'='c' }
local Table = {}
Table['key'] = 'a'
Table['key2'] = 'b'
Table['key3'] = 'c'
local Table = {}
Table[2] = 'a'
Table[8] = 'b'
Table[0] = 'c'
for k,v in pairs(Table) do
end