Skip to main content

DataStorePromises

This item only works when running on the server. Server

Utility methods to interactive with Roblox datastores.

Functions

promiseDataStore

DataStorePromises.promiseDataStore(
namestring,
scopestring
) → Promise<DataStore>

Promises a Roblox datastore object with the name and scope. Generally only fails when you haven't published the place.

promiseOrderedDataStore

DataStorePromises.promiseOrderedDataStore(
namestring,
scopestring
) → Promise<OrderedDataStore>

Promises a Roblox datastore object with the name and scope. Generally only fails when you haven't published the place.

getAsync

DataStorePromises.getAsync(
robloxDataStoreDataStore,
keystring
) → Promise<T>

Wraps :GetAsync() in a promise

updateAsync

DataStorePromises.updateAsync(
robloxDataStoreDataStore,
keystring,
updateFunc(T) → T?
) → Promise<boolean>

Wraps :UpdateAsync() in a promise

setAsync

DataStorePromises.setAsync(
robloxDataStoreDataStore,
keystring,
valuestring,
userIds{number}--

Associated userIds

) → Promise<boolean>

Wraps :SetAsync() in a promise

promiseIncrementAsync

DataStorePromises.promiseIncrementAsync(
robloxDataStoreDataStore,
keystring,
deltanumber
) → Promise<boolean>

Wraps :IncrementAsync() in a promise

removeAsync

DataStorePromises.removeAsync(
robloxDataStoreDataStore,
keystring
) → Promise<boolean>

Wraps :RemoveAsync() in a promise

promiseSortedPagesAsync

DataStorePromises.promiseSortedPagesAsync(
orderedDataStoreOrderedDataStore,
ascendingboolean,
pagesizeint,
minValuenumber?,
maxValuenumber?
) → Promise<DataStorePages>

Returns a DataStorePages object. The sort order is determined by ascending, the length of each page by pageSize, and minValue/maxValue are optional parameters which filter the results.

promiseOrderedEntries

DataStorePromises.promiseOrderedEntries(
orderedDataStoreOrderedDataStore,
ascendingboolean,
pagesizeint,
entriesint,--

Number of entries to pull

minValuenumber?,
maxValuenumber?
) → Promise<OrderedDataStoreEntry>

Types

interface OrderedDataStoreEntry {
keyany
valueany
}

Returns a DataStorePages object. The sort order is determined by ascending, the length of each page by pageSize, and minValue/maxValue are optional parameters which filter the results.

Show raw api
{
    "functions": [
        {
            "name": "promiseDataStore",
            "desc": "Promises a Roblox datastore object with the name and scope. Generally only fails\nwhen you haven't published the place.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "scope",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<DataStore>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "promiseOrderedDataStore",
            "desc": "Promises a Roblox datastore object with the name and scope. Generally only fails\nwhen you haven't published the place.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "scope",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<OrderedDataStore>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 44,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "getAsync",
            "desc": "Wraps :GetAsync() in a promise",
            "params": [
                {
                    "name": "robloxDataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 66,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "updateAsync",
            "desc": "Wraps :UpdateAsync() in a promise",
            "params": [
                {
                    "name": "robloxDataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "updateFunc",
                    "desc": "",
                    "lua_type": "(T) -> T?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "setAsync",
            "desc": "Wraps :SetAsync() in a promise",
            "params": [
                {
                    "name": "robloxDataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "userIds",
                    "desc": "Associated userIds",
                    "lua_type": "{ number }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "promiseIncrementAsync",
            "desc": "Wraps :IncrementAsync() in a promise",
            "params": [
                {
                    "name": "robloxDataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "delta",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 142,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "removeAsync",
            "desc": "Wraps :RemoveAsync() in a promise",
            "params": [
                {
                    "name": "robloxDataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 164,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "promiseSortedPagesAsync",
            "desc": "Returns a DataStorePages object. The sort order is determined by ascending,\nthe length of each page by pageSize, and minValue/maxValue are\noptional parameters which filter the results.",
            "params": [
                {
                    "name": "orderedDataStore",
                    "desc": "",
                    "lua_type": "OrderedDataStore"
                },
                {
                    "name": "ascending",
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "name": "pagesize",
                    "desc": "",
                    "lua_type": "int"
                },
                {
                    "name": "minValue",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "maxValue",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<DataStorePages>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 191,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        },
        {
            "name": "promiseOrderedEntries",
            "desc": "Returns a DataStorePages object. The sort order is determined by ascending,\nthe length of each page by pageSize, and minValue/maxValue are\noptional parameters which filter the results.",
            "params": [
                {
                    "name": "orderedDataStore",
                    "desc": "",
                    "lua_type": "OrderedDataStore"
                },
                {
                    "name": "ascending",
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "name": "pagesize",
                    "desc": "",
                    "lua_type": "int"
                },
                {
                    "name": "entries",
                    "desc": "Number of entries to pull",
                    "lua_type": "int"
                },
                {
                    "name": "minValue",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "maxValue",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<OrderedDataStoreEntry>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 232,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "OrderedDataStoreEntry",
            "desc": "",
            "fields": [
                {
                    "name": "key",
                    "lua_type": "any",
                    "desc": ""
                },
                {
                    "name": "value",
                    "lua_type": "any",
                    "desc": ""
                }
            ],
            "source": {
                "line": 218,
                "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
            }
        }
    ],
    "name": "DataStorePromises",
    "desc": "Utility methods to interactive with Roblox datastores.",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 6,
        "path": "src/datastore/src/Server/Utility/DataStorePromises.lua"
    }
}