Name
LoadPrefs -- load user preferences (V6.1)
Synopsis
LoadPrefs(prefs[, t])
Function
This function loads user preferences that have been stored using the SavePrefs() command into the table specified by prefs. Prior to calling LoadPrefs(), the prefs table should have been initialized to the default preferences. LoadPrefs() will then overwrite all table items for which custom user preferences exist and keep the default values of the items for which there are no user preferences.

Note that this function will only work if you have specified a unique identifier for your application by using the @APPIDENTIFIER preprocessor command. See APPIDENTIFIER for details.

Starting with Hollywood 9.0, this function accepts a new optional table argument that can be used to specify further options.

The following tags are currently recognized in the optional table argument:

Adapter:
This table tag can be used to specify the deserializer that should be used to import the preferences. This can be the name of an external deserializer plugin (e.g. xml) or it can be one of the following inbuilt deserializers:

Default:
Use Hollywood's default deserializer. This will deserialize data from the JSON format to a Hollywood table.

Inbuilt:
Use Hollywood's legacy deserializer. Using this deserializer is not recommended any longer as the data is in a proprietary, non-human-readable format. Using JSON is a much better choice.

If the Adapter tag isn't specified, it will default to the default set using SetDefaultAdapter().

UserTags:
This tag can be used to specify additional data that should be passed to serializer plugins. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

Inputs
prefs
table to load user preferences into
t
optional: table containing further options (see above) (V9.0)
Example
@APPIDENTIFIER "com.airsoftsoftwair.example"
prf = {lastfile$ = "Unnamed", lastxpos = 0, lastypos = 0}
LoadPrefs(prf)
This initializes the table prf to default values and then uses LoadPrefs() to read user preferences saved using SavePrefs() into the table. See SavePrefs for details.

Show TOC