mcui/input: Library Dependencies
These functions all have the same interface.
Upon return, a valid value will be stored in the named variable; if the value was not valid, the function raises an error.
parse_int
Parse a string as an integer
$1 - raw value to parse
$2 - variable name
parse_bool
Parse a string as a boolean
$1 - raw value to parse
$2 - variable name
parse_yesno
Parse a string as a yes or no answer
$1 - raw value to parse
$2 - variable name
parse_yesnocancel
Parse a string as a yes, no, or cancel answer
$1 - raw value to parse
$2 - variable name
parse_onoff
Parse a string as an on or off answer
$1 - raw value to parse
$2 - variable name
read_string
Interactively reads a string into a variable
$1 - prompt
$2 - target variable
read_silent
Same as read_string, but does not echo input.
read_and_parse
Reads a string and parses it into a typed variable
$1 - name of parser function
$2 - prompt
$3 - target variable
assert_parse
Asserts variable ($2) is type ($1) or prints error ($3)
$1 - parsing type, used to derive parsing function (e.g. 'parse_int')
$2 - name of variable
$3 - error to display if assertion fails
assert_parse_list
Asserts values ($...) are type ($1) or prints error ($2)
$1 - $ptype, $2 - $error, $3 - $var