Comprehensive Windows framework to develop in Lua
modules > console > echo

console.echo read/write property

The console.echo property is a boolean value that sets/gets the current console ECHO mode.
A console.echo property set to true means that each character entered in stdin will be written to the console stdout file. It's the default mode.
Set that property to false if you don't want to print to the console the entered text (for example, when typing passwords).
Set that property to a single char string to print to the console that character when typing on the keyboard.


local console = require "console"

console.write("Username : ")
local username = console.readln()

-- disable echo mode and use the "*" character instead for each key pressed
console.echo = "*"
console.write("Password : ")
local password = console.readln()