mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Registered OpenTX version as symbol OPENTX_VERSION in Lua
Added PlayNumber()
This commit is contained in:
parent
9285a3a9a1
commit
fc4cf73c89
1 changed files with 13 additions and 0 deletions
|
@ -47,6 +47,7 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#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))
|
||||
|
@ -131,6 +132,16 @@ static int luaPlayFile(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int luaPlayNumber(lua_State *L)
|
||||
{
|
||||
int number = luaL_checkinteger(L, 1);
|
||||
int unit = luaL_checkinteger(L, 2);
|
||||
int att = luaL_checkinteger(L, 3);
|
||||
playNumber(number, unit, att, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int luaLcdLock(lua_State *L)
|
||||
{
|
||||
lcd_locked = true;
|
||||
|
@ -822,9 +833,11 @@ void luaInit()
|
|||
lua_register(L, "getVersion", luaGetVersion);
|
||||
lua_register(L, "getValue", luaGetValue);
|
||||
lua_register(L, "playFile", luaPlayFile);
|
||||
lua_register(L, "playNumber", luaPlayNumber);
|
||||
lua_register(L, "popupInput", luaPopupInput);
|
||||
|
||||
// Push OpenTX constants
|
||||
lua_registernumber(L, "OPENTX_VERSION", VERS_NUM);
|
||||
lua_registerint(L, "DBLSIZE", DBLSIZE);
|
||||
lua_registerint(L, "MIDSIZE", MIDSIZE);
|
||||
lua_registerint(L, "SMLSIZE", SMLSIZE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue