Settings Text Box Text To A Table

I’ve spend hours to try set text box text to a table;
i’m starting to think it’s imposible

i have a table with a lot of vector3 positions

so i need to put that table in to text box so player can copy this

i tried using tostring(table) and this don’t works and make a strange text,
i tried using http service and it sets every value to “null”

any suggestions?

3 Likes

If you don’t need the indexes, you could just tostring() the Vector3s and then utilize table.concat() to combine it into 1 long string of numbers.

local myTable = {}
for i=21, 0, -1 do
	table.insert(myTable, tostring(Vector3.new(math.floor(0), math.floor(math.random(0, 21)), math.floor(0))))
end

local myNumbers = table.concat(myTable, ", ", 1, #myTable)
print(myNumbers)

This prints: 0, 18, 0, 0, 20, 0, 0, 9, 0, 0, 20, 0, 0, 8, 0, 0, 11, 0, 0, 16, 0, 0, 20, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 21, 0, 0, 6, 0, 0, 17, 0, 0, 14, 0, 0, 20, 0, 0, 7, 0, 0, 12, 0, 0, 4, 0, 0, 21, 0, 0, 11, 0, 0, 2, 0

You could then take the text provided via table.concat() and set it to the Text property of the TextBox the player will be copying from.

2 Likes

this turns table into string, is where any ways i can convert it back to table?

i figured how to convert it back to table, thank you for your help! Have a good day/night!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.