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

How do I make a string that consists of a table, so that i can use it as a table?

Asked by 4 years ago

for example I have this code

local table = "{Cald_fan = 3, otherperson = 5}"

But i want something that makes it be a table, not a string so it will be like this instead

{Cald_fan = 3, otherperson = 5}

the reason i am asking a question like this is because trello api returns strings, and the information is a table.

0
not possible to my knowledge, but why would you even want this Gameplayer365247v2 1055 — 4y
0
as i said, the trello card contains the table, and i need to get the data from the table Cald_fan 26 — 4y
0
Try using JSONDecode and JSONEncode? UltraUnitMode 419 — 4y
0
ok Cald_fan 26 — 4y
0
You would need quite a bit of string manipulation greatneil80 2647 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

This method is an alternative to JsonDecode and is not recommended because of lack in security.

local strtable = "{Cald_fan = 3, otherperson = 5}"
strtable = loadstring("return " .. strtable)() -- Make sure you enable loadstring in serverscriptservice.
Ad

Answer this question