NumberInput()
A field that only takes a number. The answer is a number.
Constructor
NumberInput(id: number, hint: string)
NumberInput(id: number, hint: string, default: number)
Parameters
| Parameters | Type | Description |
|---|---|---|
| id | number | The question's id, for Dialog:getValueById() |
| hint | string | The label on the field |
| default | number | Optional. The number before the user types one |
Example
Dialog:add(NumberInput(2, "Runs", 10):setRange(1, 999))
Dialog:show()
local runs = Dialog:getValueById(2)
Notes
- The user must enter a number: OK stays grey while the field is empty or holds something else.
setRequired(false)allows it to be empty, and the answer is thennil. setRange(min, max)keeps the number between two values.- Decimals and negative numbers are allowed.