wiki.sine.space | sinespace

Difference between revisions of "Scripting/SPersistence"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/scene/spersistence")
 
Line 1: Line 1:
The SPersistence class allows you to store persistent data to the avatar.
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/scene/spersistence
 
+
=Members=
+
{{ScriptFunction|void|SetValue|(string key, string value);|Assign the string value to the key.|5=Space.Persistence.SetValue("MyValue", "Hello World");}}
+
 
+
{{ScriptFunction|string|RetrieveValue|(string key);|Returns the saved value with the key.|5=Space.Persistence.RetrieveValue("TestValue");}}
+
 
+
{{ScriptFunction|string|SetRegionValue|(string key);|Save the string value to the key.|5=Space.Persistence.SetRegionValue("TestRegionValue","456");}}
+
 
+
{{ScriptFunction|string|RetrieveRegionValue|(string key);|Returns the saved value.|5=Space.Persistence.RetrieveRegionValue("TestRegionValue");}}
+
 
+
{{ScriptFunction|void|UpdateInfo|(Closure onComplete);|Call the onComplete function upon the server saving a value.|5=
+
Space.Persistence.SetValue("TestValue","123");<br><br>
+
Space.Persistence.UpdateInfo(function ()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local value = Space.Persistence.RetrieveValue("TestValue")<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(value)<br>
+
end)<br>
+
''--print "123" to console.''
+
}}
+
 
+
{{ScriptFunction|void|UpdateRegionInfo|(Closure onComplete);|Call the onComplete function upon the server saving a value.|5=
+
Space.Persistence.SetRegionValue("TestRegionValue","456")<br><br>
+
Space.Persistence.UpdateRegionInfo(function ()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local value = Space.Persistence.RetrieveRegionValue("TestRegionValue")<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(value)<br>
+
end)<br>
+
''--print "456" to console.''
+
}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 07:21, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/scene/spersistence