SPersistence
On this classUpdateInfo
| Function | UpdateInfo | Call the onComplete function upon the server saving a value. |
| Function | RetrieveValue | Returns the saved value with the key. |
| Function | SetValue | Save a value to the storage record that is accessed with key. |
| Function | UpdateRegionInfo | Updates your local cache with the most up-to-date values from the server. |
| Function | RetrieveRegionValue | Retrieves the saved value from "key" from your local cache. |
| Function | SetRegionValue | Save the "value" to "key" on both your local cache and on the server. |
Functions
UpdateInfo
Call the onComplete function upon the server saving a value.
Parameters
| Name | Type | Default |
|---|---|---|
| onComplete | Closure | – |
Returns
void
Example
function OnCompleteFunction()
--
end
Space.Persistence.UpdateInfo(OnCompleteFunction)
Space.Persistence.SetValue("TestValue","123");
Space.Persistence.UpdateInfo(function ()
local value = Space.Persistence.RetrieveValue("TestValue")
Space.Log(value)
end)
--print "123" to console.
RetrieveValue
Returns the saved value with the key.
Parameters
| Name | Type | Default |
|---|---|---|
| key | string | – |
Returns
string
Example
Space.Persistence.RetrieveValue("TestValue")
SetValue
Save a value to the storage record that is accessed with key.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | Max length 48 |
| value | string | Max length 255 |
Returns
void
Example
Space.Persistence.SetValue("MyValue", "Hello World");
UpdateRegionInfo
Updates your local cache with the most up-to-date values from the server. This function should be called before using the RetrieveRegionValue function.
Parameters
| Name | Type | Default |
|---|---|---|
| onComplete | Action | – |
| onComplete | Closure | – |
Returns
void
Example
Space.Persistence.SetRegionValue("TestRegionValue","456")
Space.Persistence.UpdateRegionInfo(function ()
local value = Space.Persistence.RetrieveRegionValue("TestRegionValue")
Space.Log(value)
end)
--print "456" to console.
RetrieveRegionValue
Retrieves the saved value from "key" from your local cache. The UpdateRegionInfo function should be called first to update your local cache with the most up-to-date values from the server.
Parameters
| Name | Type | Default |
|---|---|---|
| key | string | – |
Returns
string
Example
Space.Persistence.RetrieveRegionValue("TestRegionValue");
SetRegionValue
Save the "value" to "key" on both your local cache and on the server.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | Max length 48 |
| value | string | Max length 255 |
Returns
void
Example
Space.Persistence.SetRegionValue("TestRegionValue","456");



