Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the maximum Data Store size, and how can I check how much Data I'm using?

Asked by
Xduel 211 Moderation Voter
8 years ago

So I have a very large table for an inventory, and I want to save to Data Stores. Aside from the table, however, I have plans to store other stuff. So I'm trying to figure out How much Data I'm storing versus How much would be left (if any). I've looked on the Wiki, but can't seem to find the info I need / don't understand whats given. All help appreciated.

4 answers

Log in to vote
0
Answered by 8 years ago

For the DataStore limits, refer to this. I don't know any ways to see how much data you're using, since I don't know of a way to index a data store. But, if you're using up too much data, you should get an error.

Ad
Log in to vote
0
Answered by
Vitou 65 Snack Break
8 years ago

I found this on the ROBLOX Dev forum : http://devforum.roblox.com/t/datastore-data-limit-increased/21851

260000 [...] characters (so ~4x larger than before).

Also this on the wiki : http://wiki.roblox.com/index.php?title=Data_store#Data_limit

I didn't find any clues about finding the current space used.

Log in to vote
0
Answered by
Xduel 211 Moderation Voter
8 years ago

Ok, I may have an idea (Ik I'm replying to own answer, just hoping for some comments on this.) I found you can Encode JSON manually, and according to the wiki, "Tables are saved in JSON, which means that the encoded JSON string should not exceed the data limit" So maybe:

local tab = Inventory --Table's Name
local u = assert(LoadLibrary("RbxUtility"))
print(#u.EncodeJSON(tab))
Log in to vote
0
Answered by 8 years ago

Disclaimer: I haven't really dived into DataStore yet, so I may be misinterpreting what I've read.

That being said, I think Xduel was on the right track with manually encoding the table into JSON to check its length. However, some tinkering in Studio revealed that RbxUtility.EncodeJSON() is deprecated -- directing me to use Game:GetService("HttpService"):JSONEncode() instead. Here's some code:

--Here's a sample table of data.
local statsTable = {
    level = 348;
    money = 10110;
    class = "White Mage";
    is_in_party = true; --They always seem to be, anyway. :P
    dungeonsFinished = {
        fairyForest = true;
        clockworkTower = true;
        darkDescent = false;
    };
}

--Here's where we can figure out how much space the table occupies as a JSON encoded string.
local j = game:GetService("HttpService"):JSONEncode(statsTable);
print("JSON Encode: " .. j);
print("JSON length: " .. #j);

The length of the encoding will be about as long as you see it in the code. For this particular example, you should get the following output (or something very similar):

JSON Encode: {"dungeonsFinished":{"clockworkTower":true,"darkDescent":false,"fairyForest":true},"level":348,"class":"White Mage","money":10110,"is_in_party":true}

JSON length: 149

Answer this question