diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 3c6f20d42..5d0d9f8b2 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -1532,6 +1532,19 @@ static int luaGetUsage(lua_State * L) return 1; } +/*luadoc +@function getAvailableMemory() + +Get available memory remaining in the Heap for Lua. + +@retval usage (number) a value returned in b +*/ +static int luaGetAvailableMemory(lua_State * L) +{ + lua_pushunsigned(L, availableMemory()); + return 1; +} + /*luadoc @function resetGlobalTimer([type]) @@ -1759,6 +1772,7 @@ const luaL_Reg opentxLib[] = { { "chdir", luaChdir }, { "loadScript", luaLoadScript }, { "getUsage", luaGetUsage }, + { "getAvailableMemory", luaGetAvailableMemory }, { "resetGlobalTimer", luaResetGlobalTimer }, #if LCD_DEPTH > 1 && !defined(COLORLCD) { "GREY", luaGrey },