Ulysses

General => Developers Corner => Topic started by: Doomed on January 15, 2019, 12:49:34 AM

Title: SQL: table from string in row?
Post by: Doomed on January 15, 2019, 12:49:34 AM
(https://i.gyazo.com/1aa3e84bbd678baaf8a716208819f53e.png)

In MySQL, is there a way to retrieve a table of information (like in the "Classes" column) rather than just a string or integer? It gets stored as a string, I just dont know of any gmod functions that can directly convert a string to a table. thanks
Title: Re: SQL: table from string in row?
Post by: MrPresident on January 15, 2019, 06:58:41 AM
That's because MySQL doesn't store data as tables... only has strings or numbers.

You can use the following lua functions to serialize your tables and store/read them from MySQL:

http://wiki.garrysmod.com/page/util/TableToJSON
http://wiki.garrysmod.com/page/util/JSONToTable