1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

Fixes #3609 - ``background()`` function in Lua function scripts

This commit is contained in:
Bertrand Songis 2016-06-22 18:32:51 +02:00
parent 0bcd0a0c09
commit 38fdae6f1f

View file

@ -618,11 +618,15 @@ bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType)
} }
else if ((scriptType & RUN_FUNC_SCRIPT) && (sid.reference >= SCRIPT_FUNC_FIRST && sid.reference <= SCRIPT_FUNC_LAST)) { else if ((scriptType & RUN_FUNC_SCRIPT) && (sid.reference >= SCRIPT_FUNC_FIRST && sid.reference <= SCRIPT_FUNC_LAST)) {
CustomFunctionData & fn = g_model.customFn[sid.reference-SCRIPT_FUNC_FIRST]; CustomFunctionData & fn = g_model.customFn[sid.reference-SCRIPT_FUNC_FIRST];
if (!getSwitch(fn.swtch)) return false;
#if defined(SIMU) || defined(DEBUG) #if defined(SIMU) || defined(DEBUG)
filename = fn.play.name; filename = fn.play.name;
#endif #endif
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run); if (getSwitch(fn.swtch))
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
else if (sid.background)
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.background);
else
return false;
} }
else { else {
#if defined(PCBTARANIS) #if defined(PCBTARANIS)