How to concat table except one value?

I’m trying to use table.concat() for my script, and it works brilliantly. However, I want it to do every item in the table EXCEPT the first item. Anyone know how to do this?

you can just remove it

local tab = {"First value",4,6,2,7}
table.remove(tab,1)

print(table.concat(tab,",")) -- 4,6,2,7

There’s the i and the j argument in table.concat which only concatenates items from index i to index j. In your case, you could have the i argument to be 2.

https://www.lua.org/manual/5.1/manual.html#pdf-table.concat

1 Like