Skip to content

pocomane/lua_tui_mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Lua TUI mode

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.

Build

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).

Usage

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages