Read a string

A kiosk string in the script.

Keep the text in the script (or paste kiosk.txt).

Goal

Split kiosk lines and print city + units.

local text = "Nairobi,12\nMombasa,8\nKisumu,5"
for line in string.gmatch(text, "[^\n]+") do
  local city, units = string.match(line, "([^,]+),([^,]+)")
  print(city, units)
end
local text = "Nairobi kiosk\nMombasa kiosk"
local n = 0
for _ in string.gmatch(text, "[^\n]+") do n = n + 1 end
print(n)
local city, units = string.match("Nakuru,4", "([^,]+),([^,]+)")
print(city, tonumber(units))
print("kiosk.txt is a banner download — or paste the string as above")