• Can you pass a table through SetPData?
    8 replies, posted
Hey, I come here with the question, can you pass, say, a table through SetPData, or do you have to use variables.. e.g: [lua] local pies = 10 function addPie(player) player:SetPData("pie", pies) end; local table = { "value1", "value2" } function tableAdd(player) player:SetPData("tables", table) end; [/lua] Thanks for your help, sorry if this sound's really bad, but I just wanted to ask before I start to experiment with it, please note i've never used SetPData before.
You can't. Either store the variables separately or serialise them.
Would PData store some of the characters glon uses?
[QUOTE=Entoros;18191490]Would PData store some of the characters glon uses?[/QUOTE] I don't see why it wouldn't store a string.
It's not that it wouldn't store a string, but some of the box characters that GLON uses to indicate levels of a table aren't stored. I tried using the cookie library (aka sqlite) to store a player's info with glon, but it didn't store it correctly.
Use JSON then. There's [url=http://www.chipmunkav.com/downloads/Json.lua]this[/url] which I have in my gmod folder for some reason (but the site appears to be down) or [url=json.luaforge.net]this[/url] which apparently does the same thing.
Just bear in mind that JSON, unlike GLON, can't store objects specific to Gmod (i.e. entities, colors, vectors), so you'll have to store their specific values or their table itself.
How about I just make a PData like library that saves though GLON and we can all move on with this thread >_<
Yes, please. Thank's everyone for your help, has come in useful.
Sorry, you need to Log In to post a reply to this thread.