I would like to develop the lua code in an external editor like visual studio code, as i sometimes find it difficult to keep an overview of the whole code in the editor inside the browser.
Is this possible and how would i upload the code to electra one?
How do you develop lua code for complex presets?
I use an on line Lua compiler to test out a lot of the non-Electra specific code. Not a full solution, but when I need to work with arrays of values or text or other complex data structures, it’s faster and safer to work outside the E1. I tend to use onecompiler (Online lua.
When you code outside the provided E1 editor, do you copy and paste the lua code into the E1 editor after having made some changes? Or are you able to upload the code automatically with sysex messages to the E1?
I actually want to split my source code into different files, i.e. that each class is inside another lua file. I found a solution where i use gulp to assemble the lua files into a single lua file (i.e. app.lua). Then i convert the app.lua to a app.syx file with 0xF0, 0x00, 0x21, 0x45, 0x01, 0x0C at the beginning and 0xF7 at the end. This is done with the help of a python script. And finally the sysex file is sent to E1 with sendmidi.
All these described steps are defined in a gulp file, so whenever i save any lua file, app.lua is reassambled, converted to sysex and finally sent to the E1 automatically with the command gulp watch.
So far this works fine, except that i something minor in my code doesn’t work when done this way. It is related to a custom controller and runPaintCallback. I get the error: attempt to index a nil value (local 'potEvent'). Do i somehow have to wait for something? The custom controller is setup/created in preset.onLoad().
When i restart E1, the preset and lua script load fine, without any errors. So i guess it is related with the uploading of the lua code.