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.\n\nSee [DataStore], [GameDataStoreService], and [PlayerDataStoreService].\n\n```lua\n-- Data store inherits from DataStoreStage\nlocal dataStore = serviceBag:GetService(PlayerDataStoreService):PromiseDataStore(player):Yield()\n```",
"params": [
{
"name": "loadName",
"desc": "",
"lua_type": "string"
},
{
"name": "loadParent",
"desc": "",
"lua_type": "DataStoreStage?"
}
],
"returns": [
{
"desc": "",
"lua_type": "DataStoreStage"
}
],
"function_type": "static",
"source": {
"line": 54,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Store",
"desc": "Stores the value, firing off events and queuing the item for save.\n\n```lua\ndataStore:Store(\"money\", 25)\n```",
"params": [
{
"name": "key",
"desc": "",
"lua_type": "string | number"
},
{
"name": "value",
"desc": "",
"lua_type": "any"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 89,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Load",
"desc": "Loads the data at the `key` and returns a promise with that value\n\n```lua\ndataStore:Load():Then(function(data)\n\tprint(data)\nend)\n```",
"params": [
{
"name": "key",
"desc": "",
"lua_type": "string | number"
},
{
"name": "defaultValue",
"desc": "",
"lua_type": "T?"
}
],
"returns": [
{
"desc": "",
"lua_type": "Promise<T>"
}
],
"function_type": "method",
"source": {
"line": 115,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "LoadAll",
"desc": "Promises the full content for the datastore\n\n```lua\ndataStore:LoadAll():Then(function(data)\n\tprint(data)\nend)\n```",
"params": [
{
"name": "defaultValue",
"desc": "",
"lua_type": "any"
}
],
"returns": [
{
"desc": "",
"lua_type": "Promise<any>"
}
],
"function_type": "method",
"source": {
"line": 144,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "GetSubStore",
"desc": "Gets a sub-datastore that will write at the given key. This will have the same\nhelper methods as any other data store object.\n\n```lua\nlocal dataStore = DataStore.new()\n\nlocal saveslot = dataStore:GetSubStore(\"saveslot0\")\nsaveslot:Store(\"Money\", 0)\n```",
"params": [
{
"name": "key",
"desc": "",
"lua_type": "string | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "DataStoreStage"
}
],
"function_type": "method",
"source": {
"line": 168,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Delete",
"desc": "Explicitely deletes data at the key",
"params": [
{
"name": "key",
"desc": "",
"lua_type": "string | number"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 223,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Wipe",
"desc": "Queues up a wipe of all values. This will completely set the data to nil.",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 232,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Observe",
"desc": "Observes the current value for the stage itself\n\nIf no key is passed than it will observe the whole view snapshot",
"params": [
{
"name": "key",
"desc": "",
"lua_type": "string | number | nil"
},
{
"name": "defaultValue",
"desc": "",
"lua_type": "T?"
}
],
"returns": [
{
"desc": "",
"lua_type": "Observable<T>"
}
],
"function_type": "method",
"source": {
"line": 245,
"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": 304,
"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": 320,
"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": 334,
"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": 343,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "PromiseKeyList",
"desc": "Promises a list of keys in the data store stage",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Promise<{ string }>"
}
],
"function_type": "method",
"source": {
"line": 360,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "PromiseKeySet",
"desc": "Promises a set of keys in the data store stage",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Promise<{ [string]: true }>"
}
],
"function_type": "method",
"source": {
"line": 376,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "MergeDiffSnapshot",
"desc": "This will always prioritize our own view of the world over\nincoming data.\n\n:::tip\nThis is a helper method that helps load diff data into the data store.\n:::",
"params": [
{
"name": "diffSnapshot",
"desc": "",
"lua_type": "any"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 396,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "MarkDataAsSaved",
"desc": "Updates the base data to the saved / written data.\n\nThis will always prioritize our own view of the world over\nincoming data.",
"params": [
{
"name": "parentWriter",
"desc": "",
"lua_type": "DataStoreWriter"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 413,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "PromiseViewUpToDate",
"desc": "Helper method that when invokes ensures the data view.\n\n:::tip\nThis is a helper method. You probably want [DataStore.LoadAll] instead.\n:::",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Promise"
}
],
"function_type": "method",
"source": {
"line": 482,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "Overwrite",
"desc": "Ovewrites the full stage with the data specified.\n\n:::tip\nUse this method carefully as it can lead to data loss in ways that a specific :Store() call\non the right stage would do better.\n:::",
"params": [
{
"name": "data",
"desc": "",
"lua_type": "any"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 503,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "OverwriteMerge",
"desc": "Ovewrites the full stage with the data specified. However, it will merge the data\nto help prevent data-loss.\n\n:::tip\nUse this method carefully as it can lead to data loss in ways that a specific :Store() call\non the right stage would do better.\n:::",
"params": [
{
"name": "data",
"desc": "",
"lua_type": "any"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 556,
"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 | number"
},
{
"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": 578,
"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": 603,
"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.\n\n:::tip\nThis is automatically invoked during saving and is public so [DataStore] can invoke it.\n:::",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "DataStoreWriter"
}
],
"function_type": "method",
"source": {
"line": 631,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
},
{
"name": "PromiseInvokeSavingCallbacks",
"desc": "Invokes all saving callbacks\n\n:::tip\nThis is automatically invoked before saving and is public so [DataStore] can invoke it.\n:::",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Promise"
}
],
"function_type": "method",
"source": {
"line": 667,
"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.\n\nLayers in priority order:\n\n1. Save data\n2. Substores\n3. Base layer",
"realm": [
"Server"
],
"source": {
"line": 16,
"path": "src/datastore/src/Server/Modules/DataStoreStage.lua"
}
}