March 15, 2014 at 9:16 pm #20722
I’ve been unfortunately too busy with work to get much music, and even less ctrlr programming done. I am however back at it, and after having completely lost this afternoon’s lua scripting work, I decided it would be better to externalize the lua files and edit them in another editor.
As I’m already familiar, and in love with I was hoping it would be nice and easy to collect all the functions there and use the “add files” option from the Lua editor in CTRLR. It would make things like renaming, multiple line editing of sysex and such really a breeze.
Thus, I set up to copy paste every method in its own individual -lua file.
I then re-assigned the modulators to the files directly which are all saved as “functionName.lua” and thanks to that, after adding the files via the lua editor, all my methods were there and available to use.
However, the exact same code working when written directly in a method in ctrlr doesn’t work when grabbed from a file. I systematicaly get this error:
add_file_and_line() failed at lua_getstack, unknown error occured Callback error: [UPdco1WaveMessage.lua] lua runtime error .
I am sure I am missing something very obvious here, but I must say I would love some help. I was 50% in managing to have all the parameters of the MKS70/JX10 update on every patch change, but all is lost now.
I would really like to be able to work on the coding directly in Sublime and would definitely recommend to others to use it too 🙂
www.facebook.com/opuswerkMarch 26, 2014 at 11:05 am #21172
After some more research, it seems that you can use external .lua files for some functions that are called directly within lua scripts.
But for example, you cannot use them when you assign a function directly to a modulator. Be it a comboBox, or a function called by the panel on init or on MIDI receive for example.
Is this normal an expected behaviour? It would be great to be able to get all the lua outside of ctrlr. I lost a few too many times all my scripts due to a crash.
www.facebook.com/opuswerkMarch 26, 2014 at 1:00 pm #21177
Well you need to call those functions by name, i could maybe allow custom names there (not pre-loaded list of function names), and you could type in a function name that is defined in whatever place you like (an external file for example).
I don’t know if that would be sufficient though ?March 26, 2014 at 2:02 pm #21179
Thanks for your response Atom.
Right now, I can select them from the dropdown list. Seeing as they have been added via the lua editor thing. But I suppose the fact that the “.lua” suffix gets added maybe is what prevents it from working? Is there something I’m doing wrong?
Of course, for sharing’s sake, it should be possible to “wrap” them within the exported panel.
Also, while here, it would be great if “Save and Compile” would compile all files. If one function crashes because of another one it has called, you need to go and save and compile both every time 🙂
You must be logged in to reply to this topic.