SetStorageValue: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
{{Info|Function|Client|1.4.2}}
{{Info|Function|Client|1.4.2}}


{{FuncDescription|Can be used to save a variable/value on the client. Useful for some settings.
{{FuncDescription|Can be used to save/read a variable/value on the client. Useful for some settings.


Values can be retrieved with [[GetStorageValue]]. Passing "nil" as a value will delete this variable.}}
Values can be retrieved with [[GetStorageValue]]. Passing "nil" as a value will delete this variable.}}
Line 22: Line 22:


{{RelatedFunctions}}
{{RelatedFunctions}}
*[[SetStorageValue]]
*[[GetStorageValue]]
*[[GetStorageValue]]
*[[GetGameVersion]]
*[[GetGameVersion]]

Latest revision as of 18:12, 21 January 2021

SetStorageValue

Type: Function
Context: Client
Introduced: v1.4.2

Description

Can be used to save/read a variable/value on the client. Useful for some settings.

Values can be retrieved with GetStorageValue. Passing "nil" as a value will delete this variable.

Syntax

SetStorageValue(key, value)

Parameters

  • key
    The name of this value.
  • value
    The value to save, can be int, float, string and bool

Return Value

  • Returns true on success.

Example

SetStorageValue("var_str", "Some long string variable")
SetStorageValue("var_int", 1337)
SetStorageValue("var_float", 3.1415)
SetStorageValue("var_bool", true)

See also