Difference between revisions of "UI.SimpleTextInput"
From Nomad DB
Line 10: | Line 10: | ||
*'''callback:''' function (success: boolean, text: string) | *'''callback:''' function (success: boolean, text: string) | ||
*'''infoText:''' string (optional) Text below the Input field | *'''infoText:''' string (optional) Text below the Input field | ||
− | *'''maxCharacters:''' number (optional) Maximum allowed characters | + | *'''maxCharacters:''' number (optional) Maximum allowed characters (default: 99) |
If the dialog was canceled by the user, success is false and text is 'nil'. The dialog is automatically cancelled if the user opens the Console or any other UI menus. | If the dialog was canceled by the user, success is false and text is 'nil'. The dialog is automatically cancelled if the user opens the Console or any other UI menus. |
Latest revision as of 21:24, 20 August 2020
Shows a UI dialog which allows the user to enter text. The input can be confirmed by pressing Enter, the dialog can be closed with ESC key.
Syntax
UI.SimpleTextInput(title, callback[, infoText, maxCharacters])
- title: string (Title Text)
- callback: function (success: boolean, text: string)
- infoText: string (optional) Text below the Input field
- maxCharacters: number (optional) Maximum allowed characters (default: 99)
If the dialog was canceled by the user, success is false and text is 'nil'. The dialog is automatically cancelled if the user opens the Console or any other UI menus.
Example
UI.SimpleTextInput("Enter your name", function(success, text)
if success then
print("Your name is: ", text)
else
print("Dialog was canceled")
end
end)