1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00

[XFire] New function added to raise a warning popup

This commit is contained in:
Bertrand Songis 2016-11-02 22:13:34 +01:00
parent d2144001d1
commit c52e9be3d5

View file

@ -857,6 +857,38 @@ static int luaPopupInput(lua_State * L)
return 1;
}
/*luadoc
@function popupWarning(title, event)
Raises a pop-up on screen that shows a warning
@param title (string) text to display
@param event (number) the event variable that is passed in from the
Run function (key pressed)
@retval "CANCEL" user pushed EXIT key
@notice Use only from stand-alone and telemetry scripts.
@status current Introduced in 2.2.0
*/
static int luaPopupWarning(lua_State * L)
{
event_t event = luaL_checkinteger(L, 2);
warningText = luaL_checkstring(L, 1);
warningType = WARNING_TYPE_ASTERISK;
runPopupWarning(event);
if (!warningText) {
lua_pushstring(L, "CANCEL");
}
else {
warningText = NULL;
lua_pushnil(L);
}
return 1;
}
/*luadoc
@function defaultStick(channel)
@ -983,6 +1015,7 @@ const luaL_Reg opentxLib[] = {
{ "playTone", luaPlayTone },
{ "playHaptic", luaPlayHaptic },
{ "popupInput", luaPopupInput },
{ "popupWarning", luaPopupWarning },
{ "defaultStick", luaDefaultStick },
{ "defaultChannel", luaDefaultChannel },
{ "getRSSI", luaGetRSSI },