Re-arranging strings

So I’ve just been trying to make a string with the contents of a table within it. However, I’m not so good at formatting strings. I’ve looked through the strings section on the Devhub but still have no idea where to start.

local table = {"1", "2", "3"}

-- Desired output: "1, 2, 3"

Any advice or help would be appreciated!

Use table.concat:

-- You can't have the variable be named "table" or else it'll replace the table global
local t = {"1", "2", "3"}
print(table.concat(t, ", ")) --> "1, 2, 3"
1 Like