feat(lua): Port of NodeMCU Lua53 read-only tables (#2994)

* chore(lua): revert useless c light function change

This change was part of the eLua LTR patches (based on 5.1), whereby this feature was already integrated in Lua 5.2.

* feat(lua): port of NodeMCU Lua53 read-only tables

# Conflicts:
#	radio/src/lua/CMakeLists.txt
#	radio/src/lua/api_general.cpp

* fix(nv14): missing SDRAM definition

* fix: l_mathop

* fix: use float functions in drawPower()

* fix: ltable resize

* fix: correct name is "bit32"

* fix: first Lua context must be closed last

As the lookup cache is attached to that one

* Revert to Lua using double

* Ensure byte-code compatibility

* Fix possible compatibility issue with `lua_typename`/`luaL_typename`

* Fix Bitmap symbol table

* Re-add table lib for COLORLCD
This commit is contained in:
Raphael Coeffic
2023-02-09 20:29:56 +10:00
committed by GitHub
parent 72193eda82
commit be3f8d74a8
43 changed files with 1387 additions and 2211 deletions
+39 -38
View File
@@ -19,6 +19,8 @@
* GNU General Public License for more details.
*/
#define LUA_LIB
#include <ctype.h>
#include <stdio.h>
#include "opentx.h"
@@ -1737,45 +1739,44 @@ static int luaModelSetSwashRing(lua_State *L)
}
#endif // HELI
const luaL_Reg modelLib[] = {
{ "getInfo", luaModelGetInfo },
{ "setInfo", luaModelSetInfo },
{ "getModule", luaModelGetModule },
{ "setModule", luaModelSetModule },
{ "getTimer", luaModelGetTimer },
{ "setTimer", luaModelSetTimer },
{ "resetTimer", luaModelResetTimer },
{ "deleteFlightModes", luaModelDeleteFlightModes },
{ "getFlightMode", luaModelGetFlightMode },
{ "setFlightMode", luaModelSetFlightMode },
{ "getInputsCount", luaModelGetInputsCount },
{ "getInput", luaModelGetInput },
{ "insertInput", luaModelInsertInput },
{ "deleteInput", luaModelDeleteInput },
{ "deleteInputs", luaModelDeleteInputs },
{ "defaultInputs", luaModelDefaultInputs },
{ "getMixesCount", luaModelGetMixesCount },
{ "getMix", luaModelGetMix },
{ "insertMix", luaModelInsertMix },
{ "deleteMix", luaModelDeleteMix },
{ "deleteMixes", luaModelDeleteMixes },
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
{ "getCustomFunction", luaModelGetCustomFunction },
{ "setCustomFunction", luaModelSetCustomFunction },
{ "getCurve", luaModelGetCurve },
{ "setCurve", luaModelSetCurve },
{ "getOutput", luaModelGetOutput },
{ "setOutput", luaModelSetOutput },
LROT_BEGIN(modellib, NULL, 0)
LROT_FUNCENTRY( getInfo, luaModelGetInfo )
LROT_FUNCENTRY( setInfo, luaModelSetInfo )
LROT_FUNCENTRY( getModule, luaModelGetModule )
LROT_FUNCENTRY( setModule, luaModelSetModule )
LROT_FUNCENTRY( getTimer, luaModelGetTimer )
LROT_FUNCENTRY( setTimer, luaModelSetTimer )
LROT_FUNCENTRY( resetTimer, luaModelResetTimer )
LROT_FUNCENTRY( deleteFlightModes, luaModelDeleteFlightModes )
LROT_FUNCENTRY( getFlightMode, luaModelGetFlightMode )
LROT_FUNCENTRY( setFlightMode, luaModelSetFlightMode )
LROT_FUNCENTRY( getInputsCount, luaModelGetInputsCount )
LROT_FUNCENTRY( getInput, luaModelGetInput )
LROT_FUNCENTRY( insertInput, luaModelInsertInput )
LROT_FUNCENTRY( deleteInput, luaModelDeleteInput )
LROT_FUNCENTRY( deleteInputs, luaModelDeleteInputs )
LROT_FUNCENTRY( defaultInputs, luaModelDefaultInputs )
LROT_FUNCENTRY( getMixesCount, luaModelGetMixesCount )
LROT_FUNCENTRY( getMix, luaModelGetMix )
LROT_FUNCENTRY( insertMix, luaModelInsertMix )
LROT_FUNCENTRY( deleteMix, luaModelDeleteMix )
LROT_FUNCENTRY( deleteMixes, luaModelDeleteMixes )
LROT_FUNCENTRY( getLogicalSwitch, luaModelGetLogicalSwitch )
LROT_FUNCENTRY( setLogicalSwitch, luaModelSetLogicalSwitch )
LROT_FUNCENTRY( getCustomFunction, luaModelGetCustomFunction )
LROT_FUNCENTRY( setCustomFunction, luaModelSetCustomFunction )
LROT_FUNCENTRY( getCurve, luaModelGetCurve )
LROT_FUNCENTRY( setCurve, luaModelSetCurve )
LROT_FUNCENTRY( getOutput, luaModelGetOutput )
LROT_FUNCENTRY( setOutput, luaModelSetOutput )
#if defined (GVARS)
{ "getGlobalVariable", luaModelGetGlobalVariable },
{ "setGlobalVariable", luaModelSetGlobalVariable },
LROT_FUNCENTRY( getGlobalVariable, luaModelGetGlobalVariable )
LROT_FUNCENTRY( setGlobalVariable, luaModelSetGlobalVariable )
#endif
{ "getSensor", luaModelGetSensor },
{ "resetSensor", luaModelResetSensor },
LROT_FUNCENTRY( getSensor, luaModelGetSensor )
LROT_FUNCENTRY( resetSensor, luaModelResetSensor )
#if defined(HELI)
{ "getSwashRing", luaModelGetSwashRing },
{ "setSwashRing", luaModelSetSwashRing },
LROT_FUNCENTRY( getSwashRing, luaModelGetSwashRing )
LROT_FUNCENTRY( setSwashRing, luaModelSetSwashRing )
#endif
{ nullptr, nullptr } /* sentinel */
};
LROT_END(modellib, NULL, 0)