Luart
Comprehensive Windows framework to develop in Lua
modules > console > read

console.read ( length )

Reads from the console using console.stdin. The same result can be obtained using console.stdin:read()

Parameters

length

The number of characters to read from the console.

Return value

Returns the characters in a string

Example


local console = require "console"

console.writecolor("cyan", "Do you want to quit (y/n) ? ")
if console.read(1):lower() == "y" then
	sys.exit()
end