Lua string concatenation (array join) 

Joined:
04/07/2009
Posts:
178

April 15, 2014 16:25:09    Last update: April 15, 2014 16:25:09
Example session for Lua string concatenation:
> a = { 'a', 'b' }
> for i, v in pairs(a) do
   print(i..': '..v)
end
1: a
2: b
> table.insert(a, 'c')
> =table.concat(a, '.')
a.b.c
> return table.concat(a, '.', 1, 2)
a.b
> return table.concat(a, '.', 1, 3)
a.b.c
> return table.concat(a, '.', 1, #a-1)
a.b
Share |
| Comment  | Tags