Skip to main content

DataStoreStage

This item only works when running on the server. Server

Provides a data storage facility with an ability to get sub-stores. So you can write directly to this store, overwriting all children, or you can have more partial control at children level. This minimizes accidently overwriting. The big cost here is that we may leave keys that can't be removed.

Functions​

new​

DataStoreStage.new(
loadName: string,
loadParent: DataStoreStage?
) → DataStoreStage

Constructs a new DataStoreStage to load from. Prefer to use DataStore because this doesn't have any way to retrieve this.

AddSavingCallback​

DataStoreStage:AddSavingCallback(
callback: function--

May return a promise

) → function--

Call to remove

Adds a callback to be called before save. This may return a promise.

RemoveSavingCallback​

DataStoreStage:RemoveSavingCallback(callback: function) → ()

Removes a saving callback from the data store stage

GetTopLevelDataStoredSignal​

DataStoreStage:GetTopLevelDataStoredSignal() → Signal

Gets an event that will fire off whenever something is stored at this level

GetFullPath​

DataStoreStage:GetFullPath() → string

Retrieves the full path of this datastore stage for diagnostic purposes.

Load​

DataStoreStage:Load(
name: string,
defaultValue: T?
) → Promise<T>

Loads the data at the name.

Delete​

DataStoreStage:Delete(name: string) → ()

Explicitely deletes data at the key

Wipe​

DataStoreStage:Wipe() → ()

Queues up a wipe of all values. Data must load before it can be wiped.

GetSubStore​

DataStoreStage:GetSubStore(name: string) → DataStoreStage

Gets a sub-datastore that will write at the given name point

StoreOnValueChange​

DataStoreStage:StoreOnValueChange(
name: string,
valueObj: Instance--

ValueBase object to store on

) → MaidTask--

Cleanup to remove this writer and free the key.

Whenever the ValueObject changes, stores the resulting value in that entry.

HasWritableData​

DataStoreStage:HasWritableData() → boolean

If these is data not yet written then this will return true

GetNewWriter​

DataStoreStage:GetNewWriter() → DataStoreWriter

Constructs a writer which provides a snapshot of the current data state to write

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new DataStoreStage to load from. Prefer to use DataStore because this doesn't\nhave any way to retrieve this.",
            "params": [
                {
                    "name": "loadName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "loadParent",
                    "desc": "",
                    "lua_type": "DataStoreStage?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreStage"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "AddSavingCallback",
            "desc": "Adds a callback to be called before save. This may return a promise.",
            "params": [
                {
                    "name": "callback",
                    "desc": "May return a promise",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "Call to remove",
                    "lua_type": "function"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 76,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "RemoveSavingCallback",
            "desc": "Removes a saving callback from the data store stage",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "function"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 90,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "GetTopLevelDataStoredSignal",
            "desc": "Gets an event that will fire off whenever something is stored at this level",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Signal"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 103,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "GetFullPath",
            "desc": "Retrieves the full path of this datastore stage for diagnostic purposes.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 117,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "Load",
            "desc": "Loads the data at the `name`.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "defaultValue",
                    "desc": "",
                    "lua_type": "T?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 131,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "Delete",
            "desc": "Explicitely deletes data at the key",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 180,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "Wipe",
            "desc": "Queues up a wipe of all values. Data must load before it can be wiped.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 191,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "GetSubStore",
            "desc": "Gets a sub-datastore that will write at the given name point",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreStage"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 221,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "StoreOnValueChange",
            "desc": "Whenever the ValueObject changes, stores the resulting value in that entry.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "valueObj",
                    "desc": "ValueBase object to store on",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "Cleanup to remove this writer and free the key.",
                    "lua_type": "MaidTask"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 247,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "HasWritableData",
            "desc": "If these is data not yet written then this will return true",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 273,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        },
        {
            "name": "GetNewWriter",
            "desc": "Constructs a writer which provides a snapshot of the current data state to write",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreWriter"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 296,
                "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "DataStoreStage",
    "desc": "Provides a data storage facility with an ability to get sub-stores. So you can write\ndirectly to this store, overwriting all children, or you can have more partial control\nat children level. This minimizes accidently overwriting.\nThe big cost here is that we may leave keys that can't be removed.",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 10,
        "path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
    }
}