Standard Library Tables
Concat Separator
Join array-style values with table.concat.
joined text
`table.concat` returns one string, so the replay can show the scalar result without exposing a table object.
Concat Separator
concat_separator.lua
Replay: real traced execution (multi-file project)
local separator = ","
local joined = table.concat({"red", "green", "blue"}, separator)
print("separator=" .. separator)
print("joined=" .. joined)
local separator = "-"
local joined = table.concat({"red", "green", "blue"}, separator)
print("separator=" .. separator)
print("joined=" .. joined)
local separator = "|"
local joined = table.concat({"red", "green", "blue"}, separator)
print("separator=" .. separator)
print("joined=" .. joined)
separator ← ,, joined ← red,green,blue
1local separator→ , = "," --@separator="-", "|"2local joined→ red,green,blue = table.concat({"red", "green", "blue"}, separator,)3print("separator=" .. separator,)4print("joined=" .. joinedred,green,blue)outputseparator=, joined=red,green,blue
separator ← -, joined ← red-green-blue
1local separator→ - = "-"2local joined→ red-green-blue = table.concat({"red", "green", "blue"}, separator-)3print("separator=" .. separator-)4print("joined=" .. joinedred-green-blue)outputseparator=- joined=red-green-blue
separator ← |, joined ← red|green|blue
1local separator→ | = "|"2local joined→ red|green|blue = table.concat({"red", "green", "blue"}, separator|)3print("separator=" .. separator|)4print("joined=" .. joinedred|green|blue)outputseparator=| joined=red|green|blue