Difference between revisions of "Lua:messageDialog"

From Cheat Engine
Jump to navigation Jump to search
(Removed whatever the spanish person did and updated the entry.)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' messageDialog(''Text'', ''Type'', ''Button'', ...)
+
'''function''' messageDialog(''Text'', ''Type'', ''Button'', ...) ''':''' [[ButtonResult]]
  
Displays a messagebox of a specific type with a variable amount of buttons at the center of the screen with the provided text.
+
'''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]]
 
Returns: [[ButtonResult]]
 +
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 14: Line 21:
 
|Text
 
|Text
 
|String
 
|String
|The message to show
+
|The message to show.
 +
|-
 +
|Title
 +
|String
 +
|The title of the message box (optional; only for the 2nd syntax).
 
|-
 
|-
 
|Type
 
|Type
 
|[[DialogType]]
 
|[[DialogType]]
|The type of the messagebox.
+
|The type of the message box (icon/sound).
 
|-
 
|-
 
|Button
 
|Button
 
|[[ButtonType]]
 
|[[ButtonType]]
|The kind of button. There can be multiple buttons provided
+
|The kind of button. There can be multiple buttons provided.
 
|}
 
|}
  
 +
===Examples===
 +
<pre>
 +
-- Show a simple information dialog with default OK button
 +
messageDialog("Welcome to Cheat Engine!")
 +
</pre>
  
== See also ==
+
<pre>
* [[Lua]]
+
-- 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
 +
</pre>
  
 +
<pre>
 +
-- Show an error dialog with a custom title and OK button
 +
messageDialog("Critical Error", "A fatal error has occurred.", mtError, mbOK)
 +
</pre>
  
 +
<pre>
 +
-- 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
 +
</pre>
  
 +
<pre>
 +
-- Show a help dialog with Help and Close buttons
 +
messageDialog("Help", "For more information, visit the documentation.", mtInformation, mbHelp, mbClose)
 +
</pre>
  
 
+
== See also ==
== '''==EXAMPLES== by CHEATS GAMES''' ==
+
* [[ButtonResult]]
 
+
* [[DialogType]]
 
+
* [[ButtonType]]
'''messageDialog("NÃO NOS RESPONSABILIZAMOS POR BANIMENTOS\nCONTINUAR?", mtInformation, mbYes,mbNo)
+
* [[showMessage]]
 
 
MessageDialog('Do you really want to continue?', mtConfirmation, mbYes, mbNo, mbCancel, 0)
 
 
 
messageDialog("NÃO NOS RESPONSABILIZAMOS POR BANIMENTOS\nCONTINUAR?", mtError, mbYes,mbNo)
 
 
 
messageDialog("POR FAVOR SELECIONE O PROCESSO CORRETO", mtError, mbOK)
 
 
 
messageDialog("BEM VINDO!\nBY RAFAEL LIMA!", mtInformation, mbYes,mbOK)
 
 
 
messageDialog(mtError,'do i have?','Title',mbOK)
 
 
 
messageDialog('Custom dialog',mtCustom,mbYes,mbOK)
 
 
 
messageDialog(None,'do i have?','Title')
 
'''
 

Latest revision as of 23:39, 10 July 2025

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)

See also[edit]