Is there totable?

I have a table like {me, you} but as a string. So instead of {me, you} I have “{me, you}”

I know there’s a tostring, and tonumber, but is there a totable to convert it?

You can encode an object (i. e. table) to a string using JSONEncode and then decode it using JSONDecode.

So:
local table = “{“me”, “you”}”
table = HttpService:JsonEncode(table)

and then now the table is not a string?

JSONEncode changes a Lua object to a string in JSON format. JSONDecode decodes a JSON string to a Lua object.

I gave you a link that contains examples, which you can experiment with in studio.

1 Like

This might be less confusing that using JSON

local str = "{me,you}";

local array = str:sub(2,str:len()-1):split(",")

array = {“me”,“you”}

edit:
note this will only work if your string which is the array, only has strings in it, and you don’t want to store values such as integers, color3, etc.

1 Like