Returns the current mode of the console's input buffer. The mode is comprised of the following flags (refer to Microsoft's reference for details):
ENABLE_ECHO_INPUT
ENABLE_INSERT_MODE
ENABLE_LINE_INPUT
ENABLE_MOUSE_INPUT
ENABLE_PROCESSED_INPUT
ENABLE_QUICK_EDIT_MODE
- used withENABLE_EXTENDED_FLAGS
ENABLE_WINDOW_INPUT
ENABLE_VIRTUAL_TERMINAL_INPUT
By default all flags are enabled, except for ENABLE_WINDOW_INPUT
and
ENABLE_VIRTUAL_TERMINAL_INPUT
.
Note: it appears that mouse events (movements, clicks) are not processed when quick-edit mode is enabled.
Sets the current mode of the console's input buffer.
Returns the current mode of the console's output buffer.
The mode is comprised of the following flags (refer to Microsoft's reference for details):
ENABLE_PROCESSED_OUTPUT
ENABLE_WRAP_AT_EOL_OUTPUT
ENABLE_VIRTUAL_TERMINAL_PROCESSING
DISABLE_NEWLINE_AUTO_RETURN
ENABLE_LVB_GRID_WORLDWIDE
The flags ENABLE_PROCESSED_OUTPUT
and ENABLE_WRAP_AT_EOL_OUTPUT
are enabled by default.
Sets the current mode of the console's ouput buffer.
Returns the code page used for input processing.
Sets the code page used for input processing.
Returns the code page used for output processing.
Sets the code page used for output processing.
Returns lua table with basic information about the console.
Field | Value |
---|---|
"columns" | Number of columns in screen buffer |
"rows" | Number of rows in buffer |
"cx" | Cursor position column |
"cy" | Cursor position row |
"attributes" | Default character attributes |
"left" | Co-ordinate of display window in screen buffer |
"top" | Co-ordinate of display window in screen buffer |
"right" | Co-ordinate of display window in screen buffer |
"bottom" | Co-ordinate of display window in screen buffer |
"maxcols" | Maximum number of columns in display window |
"maxrows" | Maximum number of rows in display window |
Discards all input records in the input buffer.
Returns the number of unread input records in the input buffer.
Returns the number of buttons on the mouse used by the current console.
Returns an array of record events from the console input buffer without removing them. Each element returned is a table.
Note that the menu and focus events are filtered out.
Field | Value |
---|---|
"type" | "key" |
"vkey" | Virtual key code |
"state" | Control key state |
"keydown" | Boolean; true if key is pressed |
"count" | Repeat count when key held down |
Field | Value |
---|---|
"type" | "mouse" |
"x" | X coordinate (column); 0 is the leftmost column |
"y" | Y coordinate (row); 0 is the topmost row |
"event" | Type of mouse event |
"buttons" | Bit field; set if button pressed |
"state" | Control key state |
The button bit field flags are:
FROM_LEFT_1ST_BUTTON_PRESSED
RIGHTMOST_BUTTON_PRESSED
FROM_LEFT_2ND_BUTTON_PRESSED
FROM_LEFT_3RD_BUTTON_PRESSED
FROM_LEFT_4TH_BUTTON_PRESSED
The mouse event types are:
DOUBLE_CLICK
MOUSE_MOVED
MOUSE_WHEELED
- maskDIRECTION
applies
Field | Value |
---|---|
"type" | "key" |
"rows" | Number of rows in resized window |
"columns" | Number of columns in resized window |
SHIFT_PRESSED
LEFT_ALT_PRESSED
LEFT_CTRL_PRESSED
RIGHT_ALT_PRESSED
RIGHT_CTRL_PRESSED
CAPSLOCK_ON
NUMLOCK_ON
SCROLLLOCK_ON
ENHANCED_KEY
Returns an array of record events from the console input buffer, removing them from the buffer. Each element returned is a table.
Note that the menu and focus events are filtered out.
Wait for an input event. The function accepts a default argument, delay,
of the maximum number of milliseconds to wait for an event
(default: INFINITE). If delay is zero the function will return immediately.
The function returns true
if an input event was detected; otherwise false
.
Sets character attributes for the given number of cells, starting at the given coordinates.
attr
is comprised of the following flags:
FOREGROUND_RED
FOREGROUND_GREEN
FOREGROUND_BLUE
FOREGROUND_INTENSITY
BACKGROUND_RED
BACKGROUND_GREEN
BACKGROUND_BLUE
BACKGROUND_INTENSITY
Writes the given character the given number of times, starting at the given coordinates.
Sets the default attribute of characters written to the console. Note that this attribute also applies to characters echo to the console during input processing.
Write character string to the console beginning at the current cursor location. Advances the cursor. Returns number of characters written.
Returns two values: a boolean flag (visible) and an integer (size: 1..100). The boolean flag is true if the cursor is visible; false otherwise. The size value is (normally) in the range 1..100; with 100 indicating that the cursor is filling the entire cell.
Note: The size parameter does not appear to work!
Set the visibility and size of the cursor. Both arguments are optional, and default to true and 100 respectively.
Set the console cursor position as (x,y); where x is the column (0<=x<max-column) and y is the row (0<=y<max-row).
Returns the original console title.
Returns the current console title.
Sets the current console title.