File service/trigger.lua

A module of functions used to modify the functionality of classes by editing their meta-functions

Functions

get:__index (key) When get is referenced, this function is run.
set:__index (key) When set is referenced, this function is run.
trigger.bind (object1, key1, object2, key2, index, newindex) Binds two object's keys together.
trigger.setCascade (class, key) Sets a key to revert to the superview's value if it is nil.
trigger.setDefault (class, key, defaultKey) Sets a key to revert to the context's default value if it is nil.
trigger.setTrigger (class, key) Creates stub setters and getters for a given key.
trigger.setup (class) Sets up triggering for a class.


Functions

get:__index (key)
When get is referenced, this function is run. It converts a key into a getter function name

Parameters

  • key: string

Return value:

string
set:__index (key)
When set is referenced, this function is run. It converts a key into a setter function name

Parameters

  • key: string

Return value:

string
trigger.bind (object1, key1, object2, key2, index, newindex)
Binds two object's keys together. By default index and newindex are both function (v) return v end. This function can also be used for simple tables if they have no metatables attached.

Parameters

  • object1: anObject
  • key1: string
  • object2: anObject
  • key2: string
  • index: [optional] function
  • newindex: [optional] function
trigger.setCascade (class, key)
Sets a key to revert to the superview's value if it is nil. If no superview then it refers to the context's default value Called in the class's load function

Parameters

  • class: class
  • key: string
trigger.setDefault (class, key, defaultKey)
Sets a key to revert to the context's default value if it is nil. defaultKey is the key's name inside self.context.setting.default Called in the class's load function

Parameters

  • class: class
  • key: string
  • defaultKey: [optional] string
trigger.setTrigger (class, key)
Creates stub setters and getters for a given key. Called in the class's load function

Parameters

  • class: class
  • key: string
trigger.setup (class)
Sets up triggering for a class. This is called in the class's load function

Parameters

  • class: class

Valid XHTML 1.0!