Improve popupConfirmation (#7481)
This commit is contained in:
@@ -489,7 +489,7 @@ end
|
|||||||
local function runPopupPage(event)
|
local function runPopupPage(event)
|
||||||
local result
|
local result
|
||||||
if fieldPopup.status == 3 then
|
if fieldPopup.status == 3 then
|
||||||
result = popupConfirmation(fieldPopup.info, event)
|
result = popupConfirmation("Confirmation", fieldPopup.info, event)
|
||||||
else
|
else
|
||||||
result = popupWarning(fieldPopup.info, event)
|
result = popupWarning(fieldPopup.info, event)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1206,11 +1206,14 @@ static int luaPopupWarning(lua_State * L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function popupConfirmation(title, event)
|
@function popupConfirmation(title, event) deprecated, please replace by
|
||||||
|
@function popupConfirmation(title, message, event)
|
||||||
|
|
||||||
Raises a pop-up on screen that asks for confirmation
|
Raises a pop-up on screen that asks for confirmation
|
||||||
|
|
||||||
@param title (string) text to display
|
@param title (string) title to display
|
||||||
|
|
||||||
|
@param message (string) text to display
|
||||||
|
|
||||||
@param event (number) the event variable that is passed in from the
|
@param event (number) the event variable that is passed in from the
|
||||||
Run function (key pressed)
|
Run function (key pressed)
|
||||||
@@ -1219,13 +1222,24 @@ Run function (key pressed)
|
|||||||
|
|
||||||
@notice Use only from stand-alone and telemetry scripts.
|
@notice Use only from stand-alone and telemetry scripts.
|
||||||
|
|
||||||
@status current Introduced in 2.2.0
|
@status current Introduced in 2.2.0, changed to (title, message, event) in 2.3.8
|
||||||
*/
|
*/
|
||||||
static int luaPopupConfirmation(lua_State * L)
|
static int luaPopupConfirmation(lua_State * L)
|
||||||
{
|
{
|
||||||
event_t event = luaL_checkinteger(L, 2);
|
|
||||||
warningText = luaL_checkstring(L, 1);
|
|
||||||
warningType = WARNING_TYPE_CONFIRM;
|
warningType = WARNING_TYPE_CONFIRM;
|
||||||
|
event_t event;
|
||||||
|
|
||||||
|
if (lua_isnone(L, 3)) {
|
||||||
|
// only two args: deprecated mode
|
||||||
|
warningText = luaL_checkstring(L, 1);
|
||||||
|
event = luaL_checkinteger(L, 2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
warningText = luaL_checkstring(L, 1);
|
||||||
|
warningInfoText = luaL_checkstring(L, 2);
|
||||||
|
event = luaL_optinteger(L, 3, 0);
|
||||||
|
}
|
||||||
|
|
||||||
runPopupWarning(event);
|
runPopupWarning(event);
|
||||||
if (!warningText) {
|
if (!warningText) {
|
||||||
lua_pushstring(L, warningResult ? "OK" : "CANCEL");
|
lua_pushstring(L, warningResult ? "OK" : "CANCEL");
|
||||||
|
|||||||
Reference in New Issue
Block a user