Name
SavePrefs -- save user preferences (V6.1)
Synopsis
SavePrefs(prefs[, t])
Function
This function saves the table prefs, containing user preferences for your application, to an external file. You can then load these preferences back into your program the next time your program is started by using the LoadPrefs() function. The actual location where the preferences file will be stored is platform-dependent.

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 serializer that should be used to export the preferences. This can be the name of an external serializer plugin (e.g. xml) or it can be one of the following inbuilt serializers:

Default:
Use Hollywood's default serializer. This will serialize the preferences to the JSON format.

Inbuilt:
Use Hollywood's legacy serializer. This will serialize the table into a custom, proprietary format.

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 containing user preferences to save
t
optional: table containing further options (see above) (V9.0)
Example
@APPIDENTIFIER "com.airsoftsoftwair.example"
prf = {lastfile$ = "test.txt", lastxpos = 100, lastypos = 200}
SavePrefs(prf)
This saves the table prf to a platform-dependent location. At the next program start you can load the preferences by using the LoadPrefs() function. See LoadPrefs for details.

Show TOC