Breakroom is now Sinewave Campus. Book a meeting

SPersistence

العميلالمشهد
في هذا الصنفUpdateInfo
  1. الدوال
  2. UpdateInfo
  3. RetrieveValue
  4. SetValue
  5. UpdateRegionInfo
  6. RetrieveRegionValue
  7. SetRegionValue
الأعضاء 6
دالةUpdateInfoCall the onComplete function upon the server saving a value.
دالةRetrieveValueReturns the saved value with the key.
دالةSetValueSave a value to the storage record that is accessed with key.
دالةUpdateRegionInfoUpdates your local cache with the most up-to-date values from the server.
دالةRetrieveRegionValueRetrieves the saved value from "key" from your local cache.
دالةSetRegionValueSave the "value" to "key" on both your local cache and on the server.

الدوال​

UpdateInfo​

void UpdateInfo(Closure onComplete)

Call the onComplete function upon the server saving a value.

المعاملات

الاسمالنوعالقيمة الافتراضية
onCompleteClosure–

القيم المرجعة

void

مثال

Lua
function OnCompleteFunction()
--
end

Space.Persistence.UpdateInfo(OnCompleteFunction)
Lua
Space.Persistence.SetValue("TestValue","123");

Space.Persistence.UpdateInfo(function ()
local value = Space.Persistence.RetrieveValue("TestValue")
Space.Log(value)
end)
--print "123" to console.

RetrieveValue​

string RetrieveValue(string key)

Returns the saved value with the key.

المعاملات

الاسمالنوعالقيمة الافتراضية
keystring–

القيم المرجعة

string

مثال

Lua
Space.Persistence.RetrieveValue("TestValue")

SetValue​

void SetValue(string key, string value)

Save a value to the storage record that is accessed with key.

المعاملات

المعاملالنوعالوصف
keystringMax length 48
valuestringMax length 255

القيم المرجعة

void

مثال

Lua
Space.Persistence.SetValue("MyValue", "Hello World");

UpdateRegionInfo​

void UpdateRegionInfo(Action onComplete)
void UpdateRegionInfo(Closure onComplete)

Updates your local cache with the most up-to-date values from the server. This function should be called before using the RetrieveRegionValue function.

المعاملات

الاسمالنوعالقيمة الافتراضية
onCompleteAction–
onCompleteClosure–

القيم المرجعة

void

مثال

Lua
Space.Persistence.SetRegionValue("TestRegionValue","456")

Space.Persistence.UpdateRegionInfo(function ()
local value = Space.Persistence.RetrieveRegionValue("TestRegionValue")
Space.Log(value)
end)
--print "456" to console.

RetrieveRegionValue​

string RetrieveRegionValue(string key)

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.

المعاملات

الاسمالنوعالقيمة الافتراضية
keystring–

القيم المرجعة

string

مثال

Lua
Space.Persistence.RetrieveRegionValue("TestRegionValue");

SetRegionValue​

void SetRegionValue(string key, string value)

Save the "value" to "key" on both your local cache and on the server.

المعاملات

المعاملالنوعالوصف
keystringMax length 48
valuestringMax length 255

القيم المرجعة

void

مثال

Lua
Space.Persistence.SetRegionValue("TestRegionValue","456");