RosettaCodeData/Task/Associative-array-Iteration/Lua/associative-array-iteration...

9 lines
149 B
Lua

local table = {
["foo"] = "bar",
["baz"] = 6,
42 = 7,
}
for key,val in pairs(table) do
print(string.format("%s: %s\n", key, val)
end