Lua:messageDialog
(Redirected from messageDialog)
								Jump to navigation
				Jump to search
				function messageDialog(Text, Type, Button, ...) : ButtonResult
function messageDialog(Title, Text, Type, Button, ...) : ButtonResult
function messageDialog(Text) : ButtonResult
Displays a message box at the center of the screen with the provided text, icon, and buttons. You can specify a custom title, dialog type, and any combination of buttons. If only Text is provided, an information dialog with an OK button is shown.
Returns: ButtonResult
Function Parameters[edit]
| Parameter | Type | Description | 
|---|---|---|
| Text | String | The message to show. | 
| Title | String | The title of the message box (optional; only for the 2nd syntax). | 
| Type | DialogType | The type of the message box (icon/sound). | 
| Button | ButtonType | The kind of button. There can be multiple buttons provided. | 
Examples[edit]
-- Show a simple information dialog with default OK button
messageDialog("Welcome to Cheat Engine!")
-- Show a confirmation dialog with Yes and No buttons
local result = messageDialog("Do you want to save changes?", mtConfirmation, mbYes, mbNo)
if result == mrYes then
  print("User chose Yes")
else
  print("User chose No or closed the dialog")
end
-- Show an error dialog with a custom title and OK button
messageDialog("Critical Error", "A fatal error has occurred.", mtError, mbOK)
-- Show a warning dialog with Yes, No, and Cancel buttons
local res = messageDialog("Delete this file?", mtWarning, mbYes, mbNo, mbCancel)
if res == mrYes then
  print("File will be deleted.")
elseif res == mrNo then
  print("File will not be deleted.")
else
  print("Operation cancelled.")
end
-- Show a help dialog with Help and Close buttons
messageDialog("Help", "For more information, visit the documentation.", mtInformation, mbHelp, mbClose)

