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 |
|
|
|
| 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
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 27 Apr 2015 05:42 PM |
| So it does write a brand new table? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|