class ScriptPrefs

The ScriptPrefs class allows user scripts to store and retrieve settings. These stored settings are re-loaded each time Moho is run. Stored values are stored under a key name (a text string). Typically, so that different scripts don't interfere with one another, a script should use its own name as part of the key. For example, if the "MyFirstScript" script wanted to save the "pointCount" setting, it would save it using the key "MyFirstScript.pointCount".

Member Functions

void SetBool(key, value)

Store a boolean value.

Return value: none
key (string): the key to locate the value
value (bool): the value to store

bool GetBool(key, defaultValue)

Retrieve a boolean value that was previously stored.

Return value (bool): the stored value
key (string): the key to locate the value
defaultValue (bool): a default value to return if the key cannot be found

void SetInt(key, value)

Return value: none
key (string):
value (int):

int GetInt(key, defaultValue)

Return value (int):
key (string):
defaultValue (int):

void SetFloat(key, value)

Return value: none
key (string):
value (float):

float GetFloat(key, defaultValue)

Return value (float):
key (string):
defaultValue (float):

void SetString(key, value)

Return value: none
key (string):
value (string):

string GetString(key, defaultValue)

Return value (string):
key (string):
defaultValue (string):
class ScriptPrefs {
  void SetBool(const char *key, bool value);
  bool GetBool(const char *key, bool defaultValue);
 
  void SetInt(const char *key, int32 value);
  int32 GetInt(const char *key, int32 defaultValue);
 
  void SetFloat(const char *key, real value);
  real GetFloat(const char *key, real defaultValue);
 
  void SetString(const char *key, const char *value);
  const char *GetString(const char *key, const char *defaultValue);
};