From b6ea5bbddf9db836ba206127b6eb77ca21cb8fa4 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 8 Aug 2020 09:58:44 +0200 Subject: Lua channel introspection (#68) --- backends/lua.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'backends/lua.md') diff --git a/backends/lua.md b/backends/lua.md index b2f40e0..026c945 100644 --- a/backends/lua.md +++ b/backends/lua.md @@ -6,8 +6,8 @@ and manipulate events using the Lua scripting language. Every instance has its own interpreter state which can be loaded with custom scripts. To process incoming channel events, the MIDIMonster calls corresponding Lua functions (if they exist) -with the value (as a Lua `number` type) as parameter. Alternatively, a designated default channel handler -which will receive events for all incoming channels may be supplied in the configuration. +with the normalized event value (as a Lua `number` type) as parameter. Alternatively, a designated +default channel handler which will receive events for all incoming channels may be set in the configuration. The backend can also call Lua functions repeatedly using a timer, allowing users to implement time-based functionality (such as evaluating a fixed mathematical function or outputting periodic updates). @@ -25,6 +25,7 @@ The following functions are provided within the Lua interpreter for interaction | `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 | +| `channels()` | `chans = channels()` | Fetch an array of all currently known channels on the instance. Note that this function only works properly after the configuration has been read completely, i.e. any time after startup | While a channel handler executes, calling `input_value` for that channel returns the previous value. The stored value is updated once the handler returns. -- cgit v1.2.3