mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 04:15:26 +03:00
[Lua] popupConfirmation function added
This commit is contained in:
parent
6b5d2039dc
commit
19789c115c
1 changed files with 33 additions and 0 deletions
|
@ -889,6 +889,38 @@ static int luaPopupWarning(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function popupConfirmation(title, event)
|
||||
|
||||
Raises a pop-up on screen that asks for confirmation
|
||||
|
||||
@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 luaPopupConfirmation(lua_State * L)
|
||||
{
|
||||
event_t event = luaL_checkinteger(L, 2);
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
warningType = WARNING_TYPE_CONFIRM;
|
||||
runPopupWarning(event);
|
||||
if (!warningText) {
|
||||
lua_pushstring(L, warningResult ? "OK" : "CANCEL");
|
||||
}
|
||||
else {
|
||||
warningText = NULL;
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function defaultStick(channel)
|
||||
|
||||
|
@ -1016,6 +1048,7 @@ const luaL_Reg opentxLib[] = {
|
|||
{ "playHaptic", luaPlayHaptic },
|
||||
{ "popupInput", luaPopupInput },
|
||||
{ "popupWarning", luaPopupWarning },
|
||||
{ "popupConfirmation", luaPopupConfirmation },
|
||||
{ "defaultStick", luaDefaultStick },
|
||||
{ "defaultChannel", luaDefaultChannel },
|
||||
{ "getRSSI", luaGetRSSI },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue