Namespace LrPrefs

This namespace allows you to access a table of preferences that you define and store for your own plug-in. For example:
 local prefs = import 'LrPrefs'.prefsForPlugin() 
prefs.userName = 'John Smith'
Each plug-in has its own namespace for preferences; your preference names do not conflict with other plug-ins or with application preferences. (Except: Plug-ins can potentially share preferences by using a common "plugin ID" on the call to LrPrefs.prefsForPlugin.) Plug-ins do not have access to Lightroom's global preferences.

Access the functions directly from the imported namespace.

Summary

Retrieves the preferences table for a plug-in.

Functions

LrPrefs.prefsForPlugin( pluginId )
Retrieves the preferences table for a plug-in. You can store any Boolean, number, or string value as either a key or a value in this table. You can also store tables containing these types.

Note: Lightroom may not notice assignments deep in table structures. You may need to reassign a table to ensure that it is stored properly. For example:

  • prefs.mySetting = {}: Saved to prefs.
  • prefs.mySetting[ 44 ] = 'my value': May not be saved to prefs unless you trigger changes.
  • prefs.mySetting = prefs.mySetting: Causes all earlier changes to be saved.

First supported in version 1.3 of the Lightroom SDK.

Note: You must use prefs:pairs() (where prefs is the table returned by this function) to iterate this table. The built-in Lua function pairs will not work.

Parameters

1. pluginId
(string) The toolkit ID of the plug-in, or nil for the currently running plug-in. This is the value of the Lightroom-defined property key LrToolkitIdentifier. Optional as of Lightroom 3.0; it is recommended that you allow it to default.

Return value

(LrObservableTable) The preferences table for the plug-in.