ui.confirm(msg , [title])

Displays a confirmation message dialog box with a question-mark icon, and waits for the user to click the Yes, No or Cancel button.

Parameters

msg

A string, or any value converted to a string, that indicates the message to display to the user.

title

An optional string that indicates the title of the message dialog box (defaulting to "Confirmation")

Return value

This function returns the string:
  • "yes" once the user has pressed the Yes button.
  • "no" once the user has pressed the No button.
  • "cancel" once the user has pressed the Cancel button or after having closed the dialog.

Example

local ui = require "ui" -- create a new Pipe to capture output of the "WMIC ui Win32_Battery Get EstimatedChargeRemaining" command if ui.confirm("Do you want to hear a sound ?") == "yes" then sys.beep() end