Difference between revisions of "Lua:inputQuery"
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....") |
m (Minor edit. Added Version Notice Template.) |
||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| + | {{VersionNotice|6.4+}} | ||
'''function''' inputQuery(''Caption'', ''Prompt'', ''InitialString'') ''':''' String or nil | '''function''' inputQuery(''Caption'', ''Prompt'', ''InitialString'') ''':''' String or nil | ||
Latest revision as of 19:04, 4 December 2025
| ⚠️ Version Notice
This function requires Cheat Engine 6.4+. |
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[edit]
| Parameter | Type | 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[edit]
-- 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
-- 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
-- Use inputQuery for a password (not masked)
local password = inputQuery("Authentication", "Enter your password:", "")
if password then
print("Password entered.")
end