How do i turn a string into a table

What do you want to achieve?
some way to change string values into tables and the other way if possible
What is the issue?
im new to scripting and have absolutely no clue how to do this
What solutions have you tried so far?
I’ve tried looking at other posts on the devforum but they just dont make sense to me

1 Like

What do you exactly want to achieve here? If you want a string like "something='d',this='a'" then using String Patterns you can get all of the values from the string, and put it in a table.

image
like something to turn the value into a table in a script and a way to do the opposite

Inside the value

local svalue = script.Parent
local newValue = {"3" "2" "1"} 

svalue.Value = newValue

You could use HttpService to archive something you described

Example:

local HttpService = game:GetService("HttpService")
local String = "[1,2,3,4]"

local Table = HttpService:JSONDecode(String)

print(Table)

To turn a table to a string do

local HttpService = game:GetService("HttpService")

local Table = {
	1,
	2,
	3,
	4
}

local String = HttpService:JSONEncode(Table)

print(String) --[1,2,3,4]
5 Likes