Simple terminal manipulation capability for the Lua scripting language by the use of VT100 ESC sequences.
This package is based on nocurses by Rahul M. Juliato. It is aimed to simple applications where ncurses is simple "too much".
Supported platforms: Linux, MacOS and Cygwin.
-
Simple Hello World program.
-
Hello World program, that reacts on terminal size changes while waiting for keyboard input.
-
Reacts on messages from a background thread while also evaluating keyboard input.
Uses llthreads2 for thread creation and connects the nocurses lua module as notifier to a mtmsg buffer object for receiving messages from the background thread. (This is done by implementing the Notify C API, see: src/notify_capi.h)
See also original documentation at https://github.com/LionyxML/nocurses.
- Module Functions
- nocurses.awake()
- nocurses.clrline()
- nocurses.clrscr()
- nocurses.getch()
- nocurses.gettermsize()
- nocurses.gotoxy()
- nocurses.resetcolors()
- nocurses.setbgrcolor()
- nocurses.setblink()
- nocurses.setcurshape()
- nocurses.setfontbold()
- nocurses.setfontcolor()
- nocurses.setinvert()
- nocurses.settitle()
- nocurses.setunderline()
- nocurses.wait()
- Color Names
- Shape Names
-
May be called from any thread to interrupt nocurses.getch() on the main thread. The main thread is the first thread that loads the nocurses module.
-
Clears the row contents.
-
Clears the screen.
-
Gets a character without waiting for enter.
- timeout - optional float, timeout in seconds.
If timeout is given and not nil, this function returns nil if no input is available after timeout seconds.
If timeout is not given or nil this function waits without timeout until input becomes available.
This function returns nil if:
-
nocurses.awake() is called from any other thread.
-
the nocurses module is notified from native C code running in any other thread. This is done by implementing the Notify C API, see: src/notify_capi.h.
-
the terminal size changes.
-
Gets the columns and rows of the terminal.
-
Sets the cursor do the position x, y. Where x is the row number and y the line number.
-
Reset terminal to default colors.
-
nocurses.setbgrcolor(colorName)
Sets the background color to one of the colors described on the color table below.
-
Sets the blink attribute on or off. status can be true or false.
-
nocurses.setcurshape(shapeName)
Sets the shape of the cursor in the terminal in the shape table below.
-
Sets the bold attribute on or off. status can be true or false.
-
nocurses.setfontcolor(colorName)
Sets the text color to one of the colors described on the color table below.
-
Sets the invert attribute on or off. status can be true or false.
-
Sets the title of the terminal.
-
Sets the underline attribute on or off. status can be true or false.
-
Waits for the user to hit [ENTER].
Valid color names are:
- BLACK
- RED
- GREEN
- YELLOW
- BLUE
- MAGENTA
- CYAN
- WHITE
Valid shape names are:
- BLOCK_BLINK
- BLOCK
- UNDERLINE_BLINK
- UNDERLINE
- BAR_BLINK
- BAR