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

console.writecolor ( color, str1, [str2, str3...] )

Writes colored output to the console using console.stdout. The function change the color of the text (not its background). Then the function set back the text color to the previous one.
Console.write() can write more than one string, each string is separated with a space character.



A string that represents the color of the printed text. Possible values are :

str1, str2,...

The strings to write to the console. If the argument is not a string, the function converts it internally using the tostring function.
The function does not return to next line after printing the characters.

Return value

The function returns no value.


local console = require "console"

-- writes in gray
console.writeln("gray", "I'm in gray")

-- writes in red
console.writecolor("red", "Now I'm red !\n")

-- writes in white (back to the default text color)
console.writeln("white", "back to the (boring) white")