Skip to content

BlueLua/tty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TTY 🔳

Small cross-platform Lua bindings for terminal inspection.

Supports Lua 5.1, 5.2, 5.3, 5.4, 5.5, and LuaJIT.

Install

luarocks install tty

API

isTTY(fd?) -> boolean

Check whether a file descriptor or Lua file handle is attached to a terminal.

local tty = require "tty"
print(tty.isTTY())
print(tty.isTTY(2))
print(tty.isTTY(io.stdout))

size(fd?) -> rows, cols

Get the terminal size for stdout, or for a specific file descriptor or Lua file handle.

local rows, cols = tty.size()
print(("terminal: %dx%d"):format(cols, rows))

About

Small cross-platform Lua bindings for terminal inspection.

Topics

Resources

License

Stars

Watchers

Forks

Contributors