1
0
Fork 0
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:
Bertrand Songis 2016-05-17 23:41:05 +02:00
parent 4268ce9eca
commit f27a87dea4

View file

@ -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