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:
@@ -73,7 +73,6 @@ void luaEmptyEventBuffer();
|
||||
#define LUA_INIT_THEMES_AND_WIDGETS() luaInitThemesAndWidgets()
|
||||
#define lua_registernumber(L, n, i) (lua_pushnumber(L, (i)), lua_setglobal(L, (n)))
|
||||
#define lua_registerint(L, n, i) (lua_pushinteger(L, (i)), lua_setglobal(L, (n)))
|
||||
#define lua_pushtablenil(L, k) (lua_pushstring(L, (k)), lua_pushnil(L), lua_settable(L, -3))
|
||||
#define lua_pushtableboolean(L, k, v) (lua_pushstring(L, (k)), lua_pushboolean(L, (v)), lua_settable(L, -3))
|
||||
#define lua_pushtableinteger(L, k, v) (lua_pushstring(L, (k)), lua_pushinteger(L, (v)), lua_settable(L, -3))
|
||||
#define lua_pushtablenumber(L, k, v) (lua_pushstring(L, (k)), lua_pushnumber(L, (v)), lua_settable(L, -3))
|
||||
|
||||
Reference in New Issue
Block a user