mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 04:15:26 +03:00
[XFire] New function added to raise a warning popup
This commit is contained in:
parent
d2144001d1
commit
c52e9be3d5
1 changed files with 33 additions and 0 deletions
|
@ -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 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue