Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add strings to messages using tables?

Asked by 11 years ago

In a message, how do you add table strings(?) to the message's text?

1table={"hi","pizza","four"}
2mes=Instance.new("Message",workspace)
3mes.Text=""..table.."" -- trying to make it say: Text="hi, pizza, four"
4-- No, I'm not trying to do: mes.Text=""..table[1]..""..table[2]..""..table[3]..""
5-- WHAT IS THIS SORCERY

I'm sorry if this is confusing.

1 answer

Log in to vote
2
Answered by 11 years ago

So.. you're trying to make it have all the elements in a table, but not have to list each one individually?

1--Anyway if that's what you meant, then use "table.concat".
2 
3local table = {"Hey","More pizza","Five"}
4mes = Instance.new("Message", Workspace)
5mes.Text = table.concat(table," ")
6 
7--The first argument is the table, the second argument is what seperates each element. E.G if I were to put 'table.concat(table,"!")', then the message text would be "Hey!More pizza!Five"
0
Thanks! hievery1 70 — 11y
Ad

Answer this question