mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 07:15:12 +03:00
getVersion added to Lua functions
This commit is contained in:
parent
ce6e9fa4a9
commit
cde4fea817
2 changed files with 14 additions and 8 deletions
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "stamp-opentx.h"
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" {
|
||||
|
@ -76,6 +77,12 @@ void hook(lua_State* L, lua_Debug *ar)
|
|||
}
|
||||
}
|
||||
|
||||
static int luaGetVersion(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, VERS_NUM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int luaGetTime(lua_State *L)
|
||||
{
|
||||
lua_pushunsigned(L, get_tmr10ms());
|
||||
|
@ -507,7 +514,7 @@ static int luaModelDeleteMix(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int luaModelGetCustomSwitch(lua_State *L)
|
||||
static int luaModelGetLogicalSwitch(lua_State *L)
|
||||
{
|
||||
int idx = luaL_checkunsigned(L, 1);
|
||||
if (idx < NUM_CSW) {
|
||||
|
@ -527,7 +534,7 @@ static int luaModelGetCustomSwitch(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int luaModelSetCustomSwitch(lua_State *L)
|
||||
static int luaModelSetLogicalSwitch(lua_State *L)
|
||||
{
|
||||
int idx = luaL_checkunsigned(L, 1);
|
||||
if (idx < NUM_CSW) {
|
||||
|
@ -784,8 +791,8 @@ static const luaL_Reg modelLib[] = {
|
|||
{ "getMix", luaModelGetMix },
|
||||
{ "insertMix", luaModelInsertMix },
|
||||
{ "deleteMix", luaModelDeleteMix },
|
||||
{ "getCustomSwitch", luaModelGetCustomSwitch },
|
||||
{ "setCustomSwitch", luaModelSetCustomSwitch },
|
||||
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
|
||||
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
|
||||
{ "getCustomFunction", luaModelGetCustomFunction },
|
||||
{ "setCustomFunction", luaModelSetCustomFunction },
|
||||
{ "getOutput", luaModelGetOutput },
|
||||
|
@ -823,6 +830,7 @@ void luaInit()
|
|||
|
||||
// Push openTX functions
|
||||
lua_register(L, "getTime", luaGetTime);
|
||||
lua_register(L, "getVersion", luaGetVersion);
|
||||
lua_register(L, "getValue", luaGetValue);
|
||||
lua_register(L, "playFile", luaPlayFile);
|
||||
lua_register(L, "popupInput", luaPopupInput);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue