grandMA3 User Manual Publication
Confirm(string[, string[, integer[, boolean]]])

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » Confirm(string[, string[, integer[, boolean]]])
Version 2.2

Description

The Confirm Lua function provides a simple confirmation pop-up for a true/false query. It is part of the user interface functions.

Arguments

  • String:
    This string is the title for the pop-up.
  • String (optional):
    This string is the text in the pop-up.
  • Integer (optional):
    This integer is not used since the pop-up appears on all screens. The value can be nil.
  • Boolean (optional):
    This boolean defines if there is a Cancel button in the pop-up or not.
    • true: There is a Cancel button in the pop-up. This is the default option used if it is not defined.
    • false: There is only an OK button in the pop-up.

Return

  • Boolean:
    • True / 1: The pop-up was confirmed with the OK.
    • False / 0: The pop-up was not confirmed with Cancel. This is only a possible option if the Cancel button is visible.

Example

This example creates a confirmation pop-up with printed feedback in the Command Line History:

Lua
return function()
    --Creates a pop-up asking to be confirmed and prints a useful text.
    if Confirm("Confirm me", "Tap OK or Cancel", nil, true) then
        Printf("Pop-up result: OK")
    else
        Printf("Pop-up result: Cancel")
    end
end