Module xRule
This class defines logic rewriting MIDI messages, plus a sandbox environment .
A rule contains two main elements: conditions - criteria that the message has to match actions - actions to take when message got matched
Functions
match (xmsg, xrules, ruleset_idx) | |
fix_conditions () | go through conditions and fix 'stuff' * logic statements preceding conditions * consecutive logic statements |
compile () | turn the rule into an executable lua statement |
Fields
self.actions | table, indexed |
self.osc_pattern | xOscPattern - see initialize() |
self.name | string |
self.match_any | boolean, when true, we match any incoming message (applied when the rule contains no conditions) |
self.midi_enabled | boolean, if set to false we ignore midi messages |
self.last_received_message | xMessage, or implementation thereof |
self.values | easy access to values in last message (might be nil) |
self.modified_observable | tracking the generated function to detect changes |
self.sandbox | cSandbox |
self.sandbox | configure sandbox: add basic variables and a few utility methods (be very careful that all code can access used classes and methods) |
Functions
- match (xmsg, xrules, ruleset_idx)
-
Parameters:
- xmsg (xMessage or implementation thereof)
- xrules (xRules) owner
- ruleset_idx (int)
Returns:
-
table
- fix_conditions ()
- go through conditions and fix 'stuff' * logic statements preceding conditions * consecutive logic statements
- compile ()
-
turn the rule into an executable lua statement
Returns:
- boolean, true when succeeded
- string, error message
Fields
- self.actions
- table, indexed
- self.osc_pattern
- xOscPattern - see initialize()
- self.name
- string
- self.match_any
- boolean, when true, we match any incoming message (applied when the rule contains no conditions)
- self.midi_enabled
- boolean, if set to false we ignore midi messages
- self.last_received_message
- xMessage, or implementation thereof
- self.values
- easy access to values in last message (might be nil)
- self.modified_observable
- tracking the generated function to detect changes
- self.sandbox
- cSandbox
- self.sandbox
- configure sandbox: add basic variables and a few utility methods (be very careful that all code can access used classes and methods)