console.clear([color])
Clears the console screen (equivalent of the famous DOS command cls
).
Parameters
color
An optional string indicating the color to clear the console screen with. See console.bgcolor property to list the possible colors. If the color is not provided, use the current background color.
Once the console is cleared, the function revert back to the previous background color.
Return value
The function returns nothing.Example
local console = require "console"
console.writeln("This will disappear!")
-- clear the console screen with current background color
console.clear()
console.writeln("Great, a nice black board to write on !")