Difference between revisions of "inputQuery"

From Cheat Engine
Jump to navigation Jump to search
(Created page with "Category:Lua '''function''' inputQuery(''Caption'', ''Prompt'', ''InitialString'') ''':''' String or nil Displays a dialog box that prompts the user to input a string....")
 
(Blanked the page)
(Tag: Blanking)
 
Line 1: Line 1:
−
[[Category:Lua]]
 
−
'''function''' inputQuery(''Caption'', ''Prompt'', ''InitialString'') ''':''' String or nil
 
  
−
Displays a dialog box that prompts the user to input a string. 
 
−
Returns the entered string, or nil if the user cancels the dialog.
 
−
 
−
===Function Parameters===
 
−
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
−
!align="left"|Parameter
 
−
!align="left"|Type
 
−
!style="width: 80%;background-color:white;" align="left"|Description
 
−
|-
 
−
|Caption
 
−
|String
 
−
|The title of the input dialog window.
 
−
|-
 
−
|Prompt
 
−
|String
 
−
|The prompt or question to display to the user.
 
−
|-
 
−
|InitialString
 
−
|String
 
−
|The default value shown in the input field.
 
−
|}
 
−
 
−
===Examples===
 
−
<pre>
 
−
-- Ask the user for their name
 
−
local name = inputQuery("User Name", "Please enter your name:", "")
 
−
if name then
 
−
  showMessage("Hello, " .. name .. "!")
 
−
else
 
−
  showMessage("You cancelled the input.")
 
−
end
 
−
</pre>
 
−
 
−
<pre>
 
−
-- Prompt for a file name with a default value
 
−
local filename = inputQuery("Save File", "Enter the file name to save:", "myfile.txt")
 
−
if filename then
 
−
  print("Saving to: " .. filename)
 
−
end
 
−
</pre>
 
−
 
−
<pre>
 
−
-- Use inputQuery for a password (not masked)
 
−
local password = inputQuery("Authentication", "Enter your password:", "")
 
−
if password then
 
−
  print("Password entered.")
 
−
end
 
−
</pre>
 
−
 
−
== See also ==
 
−
* [[showMessage]]
 
−
* [[Lua]]
 

Latest revision as of 23:55, 10 July 2025