local title = function (str) str = tostring(str) local cap = string.upper(str:sub(1, 1)) return cap .. str:sub(2, -1) end local butt = {"john", "jacob", "jingleheimer schmidt"} local output = "" for i, name in ipairs(butt) do output = output .. title(name) if i < #butt then output = output .. ", " end end print(output)