Difference between revisions of "Cli Module"
(Created page with "The CLI module allows you to modify the look and behavior of the standard console. For more advanced controls, use the Ncurses Module instead. == clear() == '''cli.clear...") |
m (→setAttributes) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
− | == clear | + | == clear == |
'''cli.clear()''' | '''cli.clear()''' | ||
Line 8: | Line 8: | ||
− | == resetColor | + | == resetColor == |
'''cli.resetColor()''' | '''cli.resetColor()''' | ||
Line 14: | Line 14: | ||
− | == getColor | + | == getColor == |
'''number cli.getColor()''' | '''number cli.getColor()''' | ||
Line 20: | Line 20: | ||
− | == setColor | + | == setColor == |
'''cli.setColor(number foreground[, number background])''' | '''cli.setColor(number foreground[, number background])''' | ||
Line 70: | Line 70: | ||
− | == getAttributes | + | == getAttributes == |
− | '''number winWidth, number winHeight, number buffWidth, number buffHeight, number cursorX, number cursorY | + | '''number winWidth, number winHeight, number buffWidth, number buffHeight, number cursorX, number cursorY cli.getAttributes()''' |
Returns a set of console attributes. Values are in characters, not pixels! | Returns a set of console attributes. Values are in characters, not pixels! | ||
− | + | == setAttributes == | |
− | == setAttributes | + | '''cli.setAttributes(number windowWidth, number windowHeight, number bufferWidth, number bufferHeight)''' |
− | ''' | ||
Modify the console's attributes. Values should be in characters, not pixels. | Modify the console's attributes. Values should be in characters, not pixels. |
Latest revision as of 17:16, 21 March 2015
The CLI module allows you to modify the look and behavior of the standard console. For more advanced controls, use the Ncurses Module instead.
clear
cli.clear()
Clears the console window by filling it with blanks.
resetColor
cli.resetColor()
Resets the console's foreground(text) and background colors, as well as attributes, back to defaults.
getColor
number cli.getColor()
Returns the console's current attribute mask.
setColor
cli.setColor(number foreground[, number background])
Modify the console's attribute mask. You should probably use one of the color constants listed.
cli.BLACK |
cli.BLUE |
cli.GREEN |
cli.CYAN |
cli.RED |
cli.MAGENTA |
cli.YELLOW |
cli.WHITE |
cli.GRAY |
cli.LIGHT_BLUE |
cli.LIGHT_GREEN |
cli.LIGHT_CYAN |
cli.LIGHT_RED |
cli.LIGHT_MAGENTA |
cli.LIGHT_YELLOW |
cli.LIGHT_WHITE |
Due to the way attribute masks work, you may also modify the background color by multiplying a color by 16 and adding it to the text color. For example:
cli.setColor(16*cli.LIGHT_WHITE + cli.BLUE); -- This produces blue text against a light white background.
This is why getColor() only returns one value. The second parameter for setColor() has been added for your convenience.
getAttributes
number winWidth, number winHeight, number buffWidth, number buffHeight, number cursorX, number cursorY cli.getAttributes()
Returns a set of console attributes. Values are in characters, not pixels!
setAttributes
cli.setAttributes(number windowWidth, number windowHeight, number bufferWidth, number bufferHeight)
Modify the console's attributes. Values should be in characters, not pixels.