Skip to content

BlueLua/tty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 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

isatty(fd?) -> boolean

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

local tty = require "tty"
print(tty.isatty())
print(tty.isatty(2))
print(tty.isatty(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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors