SetPersistentVal Method

The SetPersistentVal method saves value to the persistent storage. The value is then available next time the script is invoked and it is also accessible from different scripts.

Syntax

SetPersistentVal(key, val)

Parameters

key

Required. String that specifies the name of the value. The string may only contain upper and lower-case A–Z, the numeric characters, 0–9, underscore, dot and colon. Length of the string is limited to 255 characters. Value names are not case sensitive.

val

Value to be saved. Only string and integer data types are supported. To delete a value set it to null.

Remarks

Since the persistent values are shared among all the scripts you should ensure to use unique name for private values. Otherwise the name can clash with another script’s private value. By convention the private name is formed according to the scheme [script_name][dot][value_name].

To retrieve saved value the script uses the GetPersistentVal method.

Example

JScript

// set public value
Salamander.SetPersistentVal("PublicValueName", 6);

// set private value
Salamander.SetPersistentVal("ScriptName.PrivateValueName", "hello");

// delete the value
Salamander.SetPersistentVal("ValueToDelete", null);

See Also

GetPersistentVal Method

Salamander Object