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

console.stdout read/write property

The console.stdout property gets the current standard console output file. It's a File value with the same methods and properties.

console.stdout redirection

Setting the console.stdout property to another File redirects console input to it : any further call to console.write() or console.stdout:write() will write output from that File (colored output won't be written to the File). Closing the console.stdout property closes the current File and reuse the default console output File.

Example


local console = require "console"

-- write "Hello World" to the console.stdout : 2 methods

-- method 1 : console.write() => indirect call to console.stdout:write()
console.write("Hello World")

-- method 1 : console.stdout:write() => direct call console.stdout's method write()
console.tdout:write("Hello World")