feat(lua): Add getSourceValue (#2316)

* Moved getFieldInfo and getValue up right after related functions

* Modified getValue to return a valid status, so Lua can see if it got zero because of invalid source id

* Added new getSourceValue Lua function per Issue #781
Also added alias getSourceInfo for getFieldInfo

* Updated according to comment https://github.com/EdgeTX/edgetx/pull/2175#issuecomment-1245605114

* Replaced isFresh() by !isOld() as requested in https://github.com/EdgeTX/edgetx/pull/2316#issuecomment-1246759370

* Clean up `lua_pushtablenil` - tables cannot hold nil values

* Changed isFresh() to !isOld() ... AGAIN

* Return both `!isOld()` and `isFresh()`

* Return nil for all values if the item does not exist

* Return 0 instead of pushing three nil values

* Update documentation
This commit is contained in:
Jesper Frickmann
2022-09-28 09:42:16 +10:00
committed by GitHub
parent 73861554ec
commit 83fbf1a7f8
4 changed files with 267 additions and 128 deletions
+1 -1
View File
@@ -489,7 +489,7 @@ extern uint8_t currentBacklightBright;
void perMain();
void per10ms();
getvalue_t getValue(mixsrc_t i);
getvalue_t getValue(mixsrc_t i, bool* valid = nullptr);
#define GETSWITCH_MIDPOS_DELAY 1
bool getSwitch(swsrc_t swtch, uint8_t flags=0);