rconsoleinput

Reads a line of console input.

Syntax

Signature
rconsoleinput() -> (string?, string?)

Aliases

  • consoleinput

Parameters

This function takes no parameters.

Returns

TypeDescription
string?Entered text, or nil on failure or cancellation.
string?Error message when no text was returned.

Notes

Windows reads a console line and removes trailing CR and LF characters. macOS opens a modal input dialog. Failure or cancellation returns nil and an error message.

Example

Luau
local Text, Error = rconsoleinput()
if Text then
    print(Text)
else
    warn(Error)
end