[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Separator in table concatenation
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 8 Dec 2012 17:29:50 +0200
It would be nice if table.concat behaved like string.gsub:
table.concat(tbl,sep)
would allow `sep` to be not only a string, but also a table or
function, indexed or called with the current list index.
E.g.
tbl = {"A","B","C"}
enumerate = function(k)
return ", "..tostring(k+1)..": "
end
print("1: "..table.concat(tbl,enumerate))
1: A, 2: B, 3: C