lua how to iterate a table code example
Example 1: lua loop through table
local Table = {'Cat', 'Dog', 'Bird'}
for i, v in pairs(Table) do
print(i .. ' ' .. v)
end
Example 2: lua for each in table
for k,v in pairs(table) do
-- k is key
-- v is value
end