2.2 KiB
2.2 KiB
With input's you are able to create a object where the user can type something in.
Here are all possible functions available for inputs:
Remember Input inherits from Object
setInputType
Changes the input type. default: text
Parameters:
stringinput type ("text", "password", "number")
Returns:
objectThe object in use
Usage:
- Creates a default input and sets it to numbers only.
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):show()
getInputType
Gets the current input type
Returns:
stringinput type
Usage:
- Creates a default input and sets it to numbers only. Also prints the current input type to log.
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):show()
basalt.debug(aInput:getInputType())
setDefaultText
Sets the default text. This will only be displayed if there is no input set by the user.
Parameters:
stringinput type ("text", "password", "number")number|colordefault background color - optionalnumber|colordefault text color - optional
Returns:
objectThe object in use
Usage:
- Creates a default input and sets the default text to "...".
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):setDefaultText(...):show()
setInputLimit
Sets a character limit to the input.
Parameters:
numbercharacter limit
Returns:
objectThe object in use
Usage:
- Creates a default input and sets the character limit to 8.
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputLimit(8):show()
getInputLimit
Returns the input limit.
Returns:
numbercharacter limit
Usage:
- Creates a default input and sets the character limit to 8. Prints the current limit.
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputLimit(8):show()
basalt.debug(aInput:getInputLimit())