diff options
| author | cbdev <cb@cbcdn.com> | 2020-03-27 21:40:45 +0100 | 
|---|---|---|
| committer | cbdev <cb@cbcdn.com> | 2020-03-27 21:40:45 +0100 | 
| commit | 253125ea28925e5207c375987ac36468327bed66 (patch) | |
| tree | d06da472ac041e2f0d85a1a98815a60d372285c2 /backends/lua.md | |
| parent | 2a079f72483aa853d68430883b2281f436512c6b (diff) | |
| download | midimonster-253125ea28925e5207c375987ac36468327bed66.tar.gz midimonster-253125ea28925e5207c375987ac36468327bed66.tar.bz2 midimonster-253125ea28925e5207c375987ac36468327bed66.zip | |
Implement python cleanup handlers
Diffstat (limited to 'backends/lua.md')
| -rw-r--r-- | backends/lua.md | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/backends/lua.md b/backends/lua.md index 30d7580..e59e513 100644 --- a/backends/lua.md +++ b/backends/lua.md @@ -15,13 +15,13 @@ The following functions are provided within the Lua interpreter for interaction  |-------------------------------|-------------------------------|---------------------------------------|  | `output(string, number)`	| `output("foo", 0.75)`		| Output a value event to a channel on this instance	|  | `interval(function, number)`	| `interval(update, 100)`	| Register a function to be called periodically. Intervals are milliseconds (rounded to the nearest 10 ms). Calling `interval` on a Lua function multiple times updates the interval. Specifying `0` as interval stops periodic calls to the function | +| `cleanup_handler(function)`	| `cleanup_handler(shutdown)`	| Register a function to be called when the instance is destroyed (on MIDIMonster shutdown). One cleanup handler can be registered per instance. Calling this function when the instance already has a cleanup handler registered replaces the handler, returning the old one. |  | `input_value(string)`		| `input_value("foo")`		| Get the last input value on a channel on this instance	|  | `output_value(string)`	| `output_value("bar")`		| Get the last output value on a channel on this instance |  | `input_channel()`		| `print(input_channel())`	| Returns the name of the input channel whose handler function is currently running or `nil` if in an `interval`'ed function (or the initial parse step) |  | `timestamp()`			| `print(timestamp())`		| Returns the core timestamp for this iteration with millisecond resolution. This is not a performance timer, but intended for timeouting, etc |  | `thread(function)`		| `thread(run_show)`		| Run a function as a Lua thread (see below) |  | `sleep(number)`		| `sleep(100)`			| Suspend current thread for time specified in milliseconds | -| `cleanup_handler(function)`	|				| Register a function to be called when the instance is destroyed (on MIDIMonster shutdown). One cleanup handler can be registered per instance. Calling this function when the instance already has a cleanup handler registered replaces the handler, returning the old one. |  Example script:  ```lua @@ -45,6 +45,7 @@ function run_show()  end  function save_values() +	-- Store state to a file, for example  end  interval(toggle, 1000) | 
