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 » Scripters
Home Search
 

Re: Data store question with saving tables

Previous Thread :: Next Thread 
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
27 Apr 2015 05:35 PM
If I saved this one game:

ds:SetAsync("Table1",{
lol = 54,
Swag = 122,
isSwag = true
})

and then the next game

ds:SetAsync("Table1",{
isSwag = false
})

It wouldn't touch any of the other values, right? Just the one I altered? So my question is, does it write a brand new table?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Apr 2015 05:38 PM
Yes, it does. So use UpdateAsync.

ds:UpdateAsync("Table1",
function(Previous)
Previous.isSwag = false
return Previous -- What you return is what the new value will be.
end)
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
27 Apr 2015 05:42 PM
So it does write a brand new table?
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
27 Apr 2015 05:51 PM
Unless of course I just did

ds:SetAsync("Table1").Blah = true

That's how you edit one value correctly, yes? While the other one writes a new table.
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
27 Apr 2015 06:20 PM
Another important thing to do with what I am doing:

On the wiki it says that mixed table, like this, will get cut off.

local table = {1,2,x=3}

But, if you were to use a table like this,

local table = {
x=5
y=true
z="hi"
}

Would it still work?
Report Abuse
Viscoelastic is not online. Viscoelastic
Joined: 04 May 2012
Total Posts: 269
27 Apr 2015 07:08 PM
I understand you, but this is the only good way to do it:

ds:UpdateAsync("Table1",
function(Previous)
Previous.x = Previous.x + 2 -- Set "x" to x + 2.
return Previous -- What you return is what the new value will be.
end)
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
27 Apr 2015 07:11 PM
You should always convert tables to JSON for saving.

You can check out the place in my blurb for an example.


I script -~ chimmihc
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
27 Apr 2015 07:19 PM
Let's just talk about my setup for now. Can you answer my questions?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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