generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Saving Tables as JSONs

Previous Thread :: Next Thread 
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:10 PM
So I have this table full of values I want to save as a JSON string.

And Im doing it like this:

local Utils = assert(LoadLibrary("RbxUtility"))
JSON = Utils.EncodeJSON(SAVETHESE)

ds:SetAsync(plyr.userId.."Stuff",JSON)
print("Saved "..plyr.Name.."'s JSON")
print(JSON)


This is my output.
'Points' is a value I am trying to save in my table.

20:08:00.526 - RbxUtility:187: Encoding of Points unsupported
20:08:00.542 - Script 'RbxUtility', Line 187 - method WriteError
20:08:00.544 - Script 'RbxUtility', Line 119 - method Write
20:08:00.545 - Script 'RbxUtility', Line 166 - method WriteTable
20:08:00.547 - Script 'RbxUtility', Line 113 - method Write
20:08:00.548 - Script 'RbxUtility', Line 483
20:08:00.549 - Script 'Workspace.Main.PlayerAssets', Line 205
20:08:00.551 - stack end

Send offers on Messor/RDC
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:23 PM
bump qq

Send offers on Messor/RDC
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
21 Mar 2014 08:25 PM
Is Points an object? Because JSON only works with
>String
>Numbers
>Booleans (uncertain)
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:26 PM
Points is a number value.
Like, a real number value.
Like:

Instance.new("NumberValue")

Send offers on Messor/RDC
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
21 Mar 2014 08:27 PM
LOL. You have to insert Points.Value, not Points.
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:30 PM
But you see, I want to insert it in the table like this:

--Before insert
blah = {}

--After insert
blah = {
Points = 70007070
}


how would I do that?

Send offers on Messor/RDC
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
21 Mar 2014 08:31 PM
blah.Points = Points.Value
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:33 PM
Is there any way I can insert that raw?
Like go from nothing in the table to points = whatever?

I dont want to have to define everything in the table and then update whats in the table.

I have over 70 values I am trying to encode.

Send offers on Messor/RDC
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
21 Mar 2014 08:34 PM
what are you even talking about dude
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
21 Mar 2014 08:36 PM
t = { Points = 100 }


t = {}
t.Points = 100



Same thing.
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:37 PM
ugh

I have an empty table.

This is my table:

MYTABLE = {}

I dont want to insert everything into the table before hand like this:

MYTABLE = {
Points = 0,
next thing = 0,
next next thing = 0,
bool thing = false,
next bool thing = true,
}


I just want to be able to script that in there.
Understand?
I dont want to just update points like this:
MYTABLE.Points = some number
I want to Insert this:
'Points = some number'


understand?


Send offers on Messor/RDC
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:38 PM
really?
Thats coolio.

Send offers on Messor/RDC
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
21 Mar 2014 08:39 PM
You don't seem to understand how tables work.
>_<
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
21 Mar 2014 08:45 PM
This is not working.

SAVETHESE = {}
local child=plyr.SavedValues:GetChildren()
for i=1, #child do
SAVETHESE.child[i] = child[i].Value
end


this also did not work




SAVETHESE = {}
local child=plyr.SavedValues:GetChildren()
for i=1, #child do
SAVETHESE.child[i].Name = child[i].Value
end

Send offers on Messor/RDC
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
21 Mar 2014 08:48 PM
SAVETHESE = {}
local child=plyr.SavedValues:GetChildren()
for i=1, #child do
SAVETHESE[child[i].Name] = child[i].Value
end



You need to index with brackets in this case.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image