This is a simple lua library to put the terminal in raw mode. It is needed in order to develop in-terminal editors, TUIs, etc.
Built packages for linux, windows and mac can be found in lua static battery.
There is no actual build system. You can compile it with gcc using:
gcc -DPOSIZ -I . -shared -o lua_tui_mode.so *.c lua_lib -lm -ldl
This assumes that you have copied the lua headers in the current directoy and
the shared library in the lua_lib file. For windows you can add change
-DPOSIX to -DWINDOWS, and add -mconsole or -mwindows (depending on if
you want or not a console to appear at start of the application).
The API is very simple:
require"lua_tui_mode".start_editor_mode()
sets the terminal in the raw mode letting you to get user input directly when
a key is pressed. In this mod the input is not blocking do I/O operation on
standard input can return nil.
require"lua_tui_mode".stop_editor_mode()
returns in the standard terminal mode that blocks untl a full line is entered.
require"lua_tui_mode".get_terminal_geometry())
return the number of cols and raws of the terminal.