Strings In Depth12 / 14
Up next

Iterate matches

-- gmatch returns an iterator over pattern matches
local s = "a,bb,ccc"
for field in string.gmatch(s, "[^,]+") do
  print(field)
end
What you're solving

string.gmatch yields each match