Jump to content
Tom Wellige

4.3 - Properties - Default

Recommended Posts

This property defines the default value of a persistent variable.

 

When reading the content of a persistent variable it is possible that the variable has not been set before. In this case the configured default value will be returned.

 

The default value takes up to 1kB (1024 Byte) of any data, like strings, booleans, numbers or dates. Data above the 1kB limit will be truncated.

Dim Welcome
Set Welcome     = new PersistentVariable
Welcome.Name    = "Welcome"
Welcome.Default = "Beep.wav"
 
PlaySound Welcome.Value

 

The above example create a persistent variable Welcome in the user Scope (default scope) of the current user. Before accessing the content the default value Beep.wav is set.

 

If at script runtime no other script has set the content of the variable before the default value will be used, i.e. a beep will be played in this example. Otherwise the previously stored content will be played.

 

The default value will also be returned in case of any error accessing the database the persistent variables are stored in. If the Persistent Variables extension is properly installed no errors should happen, but you never know...  Optional error handling will be discussed in LatestError and LatestDescription.
 

 

Index

<< Previous 4.2 - Properties - Value

>> Next 4.4 - Properties - Scope


 

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.