mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 04:15:26 +03:00
toInt16 function added
This commit is contained in:
parent
4268ce9eca
commit
f27a87dea4
1 changed files with 19 additions and 0 deletions
|
@ -754,6 +754,24 @@ static int luaPopupInput(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function toInt16(value)
|
||||
|
||||
Convert an unsigned value to signed
|
||||
|
||||
@param value (unsigned number)
|
||||
|
||||
@retval number (signed number)
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaToInt16(lua_State * L)
|
||||
{
|
||||
int16_t val = (int16_t)luaL_checkunsigned(L, 1);
|
||||
lua_pushinteger(L, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function defaultStick(channel)
|
||||
|
||||
|
@ -815,6 +833,7 @@ const luaL_Reg opentxLib[] = {
|
|||
{ "defaultStick", luaDefaultStick },
|
||||
{ "defaultChannel", luaDefaultChannel },
|
||||
{ "killEvents", luaKillEvents },
|
||||
{ "toInt16", luaToInt16 },
|
||||
#if !defined(COLORLCD)
|
||||
{ "GREY", luaGrey },
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue