File Properties.lua

Functions

Properties:getPropertyForPlugin (_plugin, name, forceRead) Reads named property value associated with catalog.
Properties:getPropertyForPluginSpanningCatalogs (pluginId, name) Gets property tied to plugin, but not to specific catalog.
Properties:getSharedProperty (name, expectedType, default) Gets shared value associated with specified name.
Properties:new (t) Constructor for new instance.
Properties:newClass (t) Constructor for extending class.
Properties:setPropertyForPlugin (_plugin, name, value, noFlush) Set property value specified by name associated with catalog.
Properties:setPropertyForPluginSpanningCatalogs (pluginId, name, value, noFlush) Set plugin property that is catalog independent.
Properties:setSharedProperty (name, value) Sets property readable by sister function.


Functions

Properties:getPropertyForPlugin (_plugin, name, forceRead)
Reads named property value associated with catalog.

Parameters:

  • _plugin: - _PLUGIN or pluginId.
  • name: - property name
  • forceRead:

Usage:

  • Substitute for non-working Lightroom version, until fixed.
  • This will be removed or replaced with the equivalent lightroom version once difficulties are resolved.
  • Reads from loaded table or loads then reads.
  • Name must be a string.
  • Throws error if problem reading properties. 

Return value:

    Value as set, which may be nil.
Properties:getPropertyForPluginSpanningCatalogs (pluginId, name)
Gets property tied to plugin, but not to specific catalog.

Parameters:

  • pluginId: plugin-id - nil for this plugin.
  • name: string or array representing leaf of hierarchically structured property.

Usage:

  • Initial application: Importer master sequence number, so an index used for import file naming into different catalogs 
    would not create conflicts in common backup bucket, or when catalogs merged...
  • Original implementation had properties kept in parent of .lrplugin folder - on retrospect, maybe not such a good idea. 
    Current implementation uses app-data dir.

Return value:

    simple value (original type not table).
Properties:getSharedProperty (name, expectedType, default)
Gets shared value associated with specified name.

Parameters:

  • name: (string or table, required) name or parameter table containing name - property name.
  • expectedType: (string, optional) expected type.
  • default: (any, optional) return value, instead of nil (note: type not checked, even if "expected type" is passed).

Usage:

  • Shared meaning all-plugins, all-catalogs, all-users, ...
  • Initial application: user-name.
  • Properties are stored in plugin parent, so they will only be shared by child plugins.
  • Throws error if name not supplied or existing properties unobtainable. 

Return values:

  1. named value, any type - default or nil if non-existing.
  2. path of properties file, if value read is nil.
Properties:new (t)
Constructor for new instance.

Parameters:

  • t:
Properties:newClass (t)
Constructor for extending class.

Parameters:

  • t:
Properties:setPropertyForPlugin (_plugin, name, value, noFlush)
Set property value specified by name associated with catalog.

Parameters:

  • _plugin: - _PLUGIN or pluginId.
  • name: - property name
  • value: - property value, may be nil.
  • noFlush: - true => refrain from writing to disk.

Usage:

  • Substitute for non-working Lightroom version, until fixed.
  • This will be removed or replaced with the equivalent lightroom version once difficulties are resolved.
  • Writes a table into file plugin-id.properties.lua with the specified property.
  • name should be string, and value should be number or string or nil.
  • Returns nothing - throws error if can't set property. 
Properties:setPropertyForPluginSpanningCatalogs (pluginId, name, value, noFlush)
Set plugin property that is catalog independent.

Parameters:

  • pluginId: plugin-id string - nil for this plugin.
  • name: string or array representing leaf of hierarchically structured property.
  • value: property value.
  • noFlush: (boolean, default: flush) set to refrain from flusing properties to disk.

Usage:

  • see 'get' function
  • Returns nothing - throws error if trouble. 
Properties:setSharedProperty (name, value)
Sets property readable by sister function.

Parameters:

  • name:
  • value:

Usage:

  • see 'get' function.
  • Returns nothing - throws error if trouble. 

Valid XHTML 1.0!