|
| 28 Nov 2015 10:15 PM |
| I have been notified a game I am helping develop is having saving problems today, which no one has manipulated the Script that controls Data saving. The error found in Developer Consul is basically saying " Dictionary cannot be saved to DataStore ". Is this a problem on ROBLOX behalf or possibly the scripting? |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:17 PM |
| Make sure you're JSON encoding/decoding the dictionary? |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:17 PM |
Dictionaries cannot be stored in datastore(i wish it error that when i was using datastore)
Instead of:
local Table = { ["thing"] = 1; ["foo"] = 2; }
print(Table.foo)
try:
local Table = { 1, 2 }
print(Table[2]) |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:31 PM |
| Correct me if I'm wrong but I'm certain you can save dictionaries to datastore if you convert it to JSON |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:35 PM |
| ^I'm interested,how do you do that? |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:37 PM |
For encoding the dictionary: http://wiki.roblox.com/index.php?title=API:Class/HttpService/JSONEncode
For decoding JSON: http://wiki.roblox.com/index.php?title=API:Class/HttpService/JSONDecode |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Nov 2015 10:50 PM |
| I recommend not encoding to json if you don't need too. Takes up more resources, time, and roblox reorders it weirdly. |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 10:54 PM |
| It takes up barely any resources, I don't understand how it takes up more time, and I've never had any problems with "weird reordering". |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 11:08 PM |
| Okay, thanks for the information. @everyone |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 28 Nov 2015 11:14 PM |
hush dont listen to him
when you use datastores it automatically encodes/decodes
anyways whats your code
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 11:21 PM |
"when you use datastores it automatically encodes/decodes"
Not if you're using dictionaries. |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 28 Nov 2015 11:22 PM |
"Tables are saved in JSON" - http://wiki.roblox.com/index.php/Data_store
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 11:31 PM |
If it automatically converted dictionaries to JSON strings, he obviously wouldn't be getting the error "Dictionary cannot be saved to DataStore".
I just tested it and saving to datastore with dictionaries works perfectly fine as long as you convert to JSON. |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2015 11:35 PM |
Hm - on second thought, that error is a bit vague. Does it mean that dictionaries can't be saved to datastores, or does it mean the dictionary he is specifically saving cannot be saved?
g |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 28 Nov 2015 11:44 PM |
hes probably doing something like this
local table = { "a", ["abc"] = "this wont work in datastores" }
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
| |
|