I've noticed that there are a lot of abort() called in the lua library, which we NEVER want to happen as this crashes the entire program. We want to just fail parsing and return silence from the function. This is already done in parse() but clearly is doesn't catch every case. Just need to have a look at the stack trace to see where it's crashing and either change what functions we call to parse the code, or in the worst case change the lua library code.
Similar to the prev. issue, if parsing ever fails, we should save the script/function of whatever was previously successfully parsed and either save it or reparse it. That way, the audio keeps playing and doesn't constantly cut out whenever you make an edit to it.
This should be fairly straightforward and can be done in the LuaParser.cpp/.h files.
Increase stability
Lua live-coding is unstable for certain scripts. Some examples I've noticed are:
But there are probably several others.
The code that handles parsing Lua scripts is in LuaParser.cpp, specifically in the parse() function https://github.com/jameshball/osci-render-juce/blob/9293214943af555d2aaa15eb4f71dc3771a66a9d/Source/lua/LuaParser.cpp#L18
I've noticed that there are a lot of abort() called in the lua library, which we NEVER want to happen as this crashes the entire program. We want to just fail parsing and return silence from the function. This is already done in parse() but clearly is doesn't catch every case. Just need to have a look at the stack trace to see where it's crashing and either change what functions we call to parse the code, or in the worst case change the lua library code.
The Lua C API is fairly complicated, but there is a good reference here https://www.lua.org/manual/5.3/manual.html
Save last successful script
Similar to the prev. issue, if parsing ever fails, we should save the script/function of whatever was previously successfully parsed and either save it or reparse it. That way, the audio keeps playing and doesn't constantly cut out whenever you make an edit to it.
This should be fairly straightforward and can be done in the LuaParser.cpp/.h files.