TextInput([string[, string[, integer[, integer]]]])
Description
Section titled âDescriptionâThe TextInput Lua function opens a text input pop-up and returns the typed input as a string. It is part of the user interface functions.
Arguments
Section titled âArgumentsâ- String (optional):
This string is the title for the pop-up. The title bar has a default âEditâ text at the beginning of the title that cannot be removed. - String (optional):
This string is the text already in the input field - can be used to provide user guidance. - Integer (optional):
This integer defines a position on the x-axis where the pop-up should appear (on all screens). â0â is on the left side of the screen. Nil or undefined is centered. - Integer (optional):
This integer defines a position on the y-axis where the pop-up should appear (on all screens). â0â is at the top of the screen. Nil or undefined is centered.
- String:
The returned user input.
Example
Section titled âExampleâTo open a text input and print the entered value in the Command Line History, create a plugin with this code:
| Copy CodeLua |
| ``` |
| return function() |
-- Create a pop-up with the title and an input field containing some default text-- The returned text is store in a Lua variablelocal input = TextInput("This is the title","Please provide your input here")-- Print the returned text valuePrintf("You entered this message: %s",tostring(input))end