1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 03:49:52 +03:00

Lua: Use incremental GC and also call it for Widgets (#4369)

Fixes #3885: Error in Lua Widget options handled better (does not disable entire Lua state)
Disable Lua Widget if any of its functions has error.
This commit is contained in:
Damjan Adamic 2017-02-04 10:58:06 +01:00 committed by Bertrand Songis
parent d594843de2
commit b493973d7d
11 changed files with 213 additions and 89 deletions

View file

@ -44,6 +44,9 @@ extern "C" {
extern lua_State * lsScripts;
extern lua_State * lsWidgets;
extern bool luaLcdAllowed;
#if defined(COLORLCD)
extern uint32_t luaExtraMemoryUsage;
#endif
void luaInit();
void luaInitThemesAndWidgets();
@ -116,8 +119,9 @@ extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
void luaClose(lua_State ** L);
bool luaTask(event_t evt, uint8_t scriptType, bool allowLcdUsage);
void luaExec(const char * filename);
void luaDoGc(lua_State * L, bool full);
void luaError(lua_State * L, uint8_t error, bool acknowledge=true);
int luaGetMemUsed(lua_State * L);
uint32_t luaGetMemUsed(lua_State * L);
void luaGetValueAndPush(lua_State * L, int src);
#define luaGetCpuUsed(idx) scriptInternalData[idx].instructions
uint8_t isTelemetryScriptAvailable(uint8_t index);