Lua scripting is a very nice feature. However, seems like DSP plugins are limited to a single file because you can’t use ‘require’:
LuaProc: Error: [string “local some_module = require(‘some_module’)…”]:1: attempt to call a nil value (global ‘require’)
But you can use ‘require’ in a scripting window. Is it planned to be turned on for DSP scripting?
Scripts are self-contained and saved with the session. Relying on external files will make scripts not portable. So no,
require is not be available in scripts which can be loaded (DSP, session-scripts, actions). If you could load an external file and that file changes, is moved or becomes not-available, that may break the session.
The scripting window is special: Those scripts are not saved with the session and hence the limitation does not apply.
Related to this, there is the plan to add a feature to “re-read script from disk if available” to aid development and testing of scripts, but currently it’s one way, once a script is loaded, there’s no reference to the file on disk where it came from.
Thank you for the reply. Will use lua-amalg in my case.
Got it to work. Needed to implement simple require function, though.
If anybody will have similar needs, you can use the following snippet: https://gist.github.com/Penguinum/a251002ffd79ba9975a0aecbe8515b80