Cli Module

From SolarStrike wiki
Jump to: navigation, search

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.