Fix certain Lua script errors hanging the GUI (#899)

* Fixed a bug where a standalone Lua script w/o a run function will hang the GUI on non-color radios

* Prevent Lua standalone window from opening if Lua failed on load

* Fixed scroll down key in TX12 simulator
Copied key definitions from TX16S

* Fixed the Lua error trying to call nil value when no scripts are loaded.

* I messed up in the previous commit; now it does not freeze and it does not call nil.
This commit is contained in:
Jesper Frickmann
2021-10-15 12:03:23 +11:00
committed by GitHub
parent b1a41438a3
commit ecf386e71f
4 changed files with 18 additions and 12 deletions
+2 -2
View File
@@ -334,8 +334,8 @@ void RadioSdManagerPage::build(FormWindow * window)
std::string fullpath = currentPath + "/" + name;
menu->addLine(STR_EXECUTE_FILE, [=]() {
luaExec(fullpath.c_str());
//TODO: check 'luaState'
StandaloneLuaWindow::instance()->attach(window);
if (luaState != INTERPRETER_RELOAD_PERMANENT_SCRIPTS)
StandaloneLuaWindow::instance()->attach(window);
});
}
#endif
+3 -1
View File
@@ -126,8 +126,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
*((char *)getBasename(toolPath)-1) = '\0';
f_chdir(toolPath);
StandaloneLuaWindow::instance()->attach(window);
luaExec(path_str.c_str());
if (luaState != INTERPRETER_RELOAD_PERMANENT_SCRIPTS)
StandaloneLuaWindow::instance()->attach(window);
return 0;
},
OPAQUE);