File Object.lua

Functions

Object.createClass (register, ...) Create a class from two or more parents.
Object.getClassItems () Get registered classes/tables as item array suitable for combo box.
Object.getDebugFunction (name) Get debug function.
Object.register (name, reg, _reg) Register non-class/plain-table object (a.k.a pseudo-class) for inclusion on class-enable form, and/or fetch a debug function.
Object:getClassName () Get "leaf" class name.
Object:getFullClassName () Get unique full class name in dot notation (excludes 'Object' ancestry in inheritance path).
Object:getPropertyKeyName () Get full class name suitable for indexing property table, which must not include dots.
Object:inherit (BaseClass) Inherit base class members directly (via class object) instead of indirectly (via metatable) if need be.
Object:new (t) Creates an object.
Object:newClass (t) Constructor for extending class.
Object:toString () Method for getting short synopsis-style display string for debugging/logging.


Functions

Object.createClass (register, ...)
Create a class from two or more parents.

Parameters:

  • register: boolean true iff hybrid class should be registered for advanced debug support.
  • ...: base classes.

Usage:

  • If only one parent, just use the 'new' method.
  • See in book "Programming in Lua: Multiple Inheritance".
  • @2011-01-19: Integrated properly into framework, including advanced debug support. 

Return value:

    Class object with multiple inheritance, plus debug function.
Object.getClassItems ()
Get registered classes/tables as item array suitable for combo box.

Return value:

    array of strings with full-name of all registered classes or pseudo-classes.
Object.getDebugFunction (name)
Get debug function.

Parameters:

  • name:

Usage:

    - if object is registered, it will be tied to plugin manager enable/disable, otherwise always enabled. 
Object.register (name, reg, _reg)
Register non-class/plain-table object (a.k.a pseudo-class) for inclusion on class-enable form, and/or fetch a debug function.

Parameters:

  • name: Registration and/or debug entity name.
  • reg:
  • _reg: True or nil to register, false to forego registration, in which case this is really just a convenience function for defining a dbg function.

Usage:

    need to register objects during init for advanced debugging - NOT upon each invocation of a menu item... 

Return values:

  1. empty table for syntactical convenience.
  2. debug function (see app-debug-trace function for more info).
Object:getClassName ()
Get "leaf" class name.

Usage:

  • Most useful for debugging...
  • Short & informal..., but not necessarily unique. 

Return value:

    string: e.g. 'SpecialExport'
Object:getFullClassName ()
Get unique full class name in dot notation (excludes 'Object' ancestry in inheritance path).

Usage:

  • Most useful for debugging...
  • Guaranteed to be unique. 

Return value:

    string: e.g. 'Export.SpecialExport'
Object:getPropertyKeyName ()
Get full class name suitable for indexing property table, which must not include dots.
Object:inherit (BaseClass)
Inherit base class members directly (via class object) instead of indirectly (via metatable) if need be.

Parameters:

  • BaseClass:

Usage:

    this is useful for classes like Export/Publish - Lightroom won't consult metatable for static member functions... 
Object:new (t)
Creates an object.

Parameters:

  • t: Initialization table, for convenience - members could be assigned to table upon return for same effect.

Usage:

  • Inheritable constructor method, for one-parent classes.
  • Called with class-name for creating classes derived from Object.
  • Called without class-name in derived class constructors for creating base Object functionality in derived instance.
    - Note: in this case, it must be called using dot notation (instead of colon notation), since function must be Object.new,
    but self parameter must be derived class object.

Return value:

    object - as table, with metatable index set to derived class object, throws error if trouble.
Object:newClass (t)
Constructor for extending class.

Parameters:

  • t:
Object:toString ()
Method for getting short synopsis-style display string for debugging/logging.

Usage:

    Default is full class name - override for something better. 

Valid XHTML 1.0!