Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you print everything in a table in the same line? [Answered]

I was wondering if anyone can tell me how to print anything in a table(temptable) in the same line, without creating a new one for each item in it.

Script I've tried:

local temptable = {"Test","Test2"}
for _,v in pairs(temptable) do
	print(v)
end

But that does:

Test
Test2

Instead, I want it to do:

Test Test2

Any suggestions on how I could accomplish this? Any help appreciated.

3 comments

1

Thanks, table.concat worked.

0

Does the write() work in roblox? You could try it. I know it's answered... Just saying.

1 answer

A nice, built-in Lua function for working with tables: unpack (or table.unpack in Lua 5.3)

table = {'as', 'df'};

print(unpack(table));

1 comment

0

This is awesome. Thank you for the great answer! I couldn't find this anywhere on the internet except here.

This discussion is preserved as it was. New answers, comments, and votes are closed.