Fundamentals3 / 14
Up next

Generic for

-- generic for with ipairs yields index, value
local colors = {"red", "green", "blue"}
for index, color in ipairs(colors) do
  print(index, color)
end
What you're solving

ipairs walks array entries in order