3 Data Storage
Max edited this page 2015-03-01 22:51:07 +03:00

General

A Cloud-based Data Storage storage system.

The Data Store is limited to 16MB per key.

For all functions following, you should whether you want to manipulate on global data storage or user's own one.

Fetching a data

Returns data from the Data Store.

local data = GJ.fetchData(key, isGlobal)

Setting a data

Sets data in the Data Store.

local success = GJ.setData(key, data, isGlobal)

You can also use GJ.setBigData which is aimed to send larger chunks of data (is using POST instead of GET).

Updating a data

Updates data in the Data Store.

There are few mathematical operations avalaible: add, subtract, multiply and divide. The string operations are append and prepend. Note: you can only perform mathematic operations on numeric data.

local newData = GJ.updateData(key, value, operation, isGlobal)

Removing a data

Removes data from the Data Store.

local success = GJ.removeData(key, isGlobal)

Fetching storage keys

Returns all the keys in either the game's global data store, or all the keys in a user's data store. The result is array of strings.

-- let's print all the keys
local list = GJ.fetchStorageKeys(isGlobal)

for _, v in ipairs(list) do print(v) end