Difference between revisions of "Lua:messageDialog"

From Cheat Engine
Jump to navigation Jump to search
(Tipos de Mensagens-Types of messages (messageDialog) -Cortesia/Courtesy CHEATS GAMES)
(Removed whatever the spanish person did and updated the entry.)
 
(3 intermediate revisions by one other user 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>
  
{{LuaSeeAlso}}
+
<pre>
 
+
-- 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
Autor: Rafael Lima
+
  print("User chose No or closed the dialog")
Facebook: www.facebook.com/officialrafaellima
+
end
Discord: CHEATS GAMES#6003
+
</pre>
Youtube: www.youtube.com/c/CHEATSGAMES
 
Contato: contato@cheatenginebrasil.com.br
 
 
 
---[[
 
Para executar as mensagens, clique em:
 
Table>Show Cheat Table Lua script
 
Cole uma das mensagens abaixo e clique em "Execute Script"
 
 
 
To run the messages, click:
 
Table> Show Cheat Table Lua script
 
Paste one of the messages below and click on "Execute Script"
 
]]---
 
 
 
  
--ERRO:
+
<pre>
messageDialog("MENSAGEM DE ERRO",mtError, mbYes, mbNo)
+
-- Show an error dialog with a custom title and OK button
 +
messageDialog("Critical Error", "A fatal error has occurred.", mtError, mbOK)
 +
</pre>
  
--INFORMATION
+
<pre>
messageDialog("MENSAGEM DE INFORMACAO",mtInformation, mbYes, mbNo)
+
-- 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>
  
--CONFIRMATION
+
<pre>
messageDialog("MENSAGEM DE CONFIRMACAO",mtConfirmation, mbYes, mbNo)
+
-- Show a help dialog with Help and Close buttons
 +
messageDialog("Help", "For more information, visit the documentation.", mtInformation, mbHelp, mbClose)
 +
</pre>
  
--WARNING:
+
== See also ==
messageDialog("MENSAGEM DE PERIGO",mtWarning, mbYes, mbNo)
+
* [[ButtonResult]]
 +
* [[DialogType]]
 +
* [[ButtonType]]
 +
* [[showMessage]]

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]