Luart
Comprehensive Windows framework to develop in Lua
modules > sys > File > readln

File : readln ( ) method

Reads data from the file until end of line is encountered.

Return value

Returns the data as a string (for utf8 and unicode encoding) or as a Buffer (for binary encoding).

Example


local console = require "console"

console.write("What's you're name ? ")

-- read all characters from console.stdin until the key ENTER or RETURN is pressed
local name = console.stdin:readln()
print("Nice to meet you "..name.." !")