# tmux client library for Lua

Source: https://libtmux.org/en/lua/latest/core/

> tmux client library for Lua. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents

Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents.

## At a glance

| Type | Wraps |
| ---- | ----- |
| [`libtmux.Server`](https://libtmux.org/en/lua/latest/reference/libtmux-server/) | A tmux server |
| [`libtmux.Session`](https://libtmux.org/en/lua/latest/reference/libtmux-session/) | A session, ID `$n` |
| [`libtmux.Window`](https://libtmux.org/en/lua/latest/reference/libtmux-window/) | A window in a session, ID `@n` |
| [`libtmux.Pane`](https://libtmux.org/en/lua/latest/reference/libtmux-pane/) | A pane in a window, ID `%n` |

## Typed API

- Typed objects instead of parsed format strings: [`libtmux.SnapshotPane`](https://libtmux.org/en/lua/latest/reference/libtmux-snapshotpane/)
- Filtering and queries over tmux objects: [`libtmux.Selection`](https://libtmux.org/en/lua/latest/reference/libtmux-selection/)
- Typed errors instead of exit codes and stderr: [`libtmux.Error`](https://libtmux.org/en/lua/latest/reference/libtmux-error/)

## What you get over the tmux CLI

- Connect to or start a tmux server: [`libtmux.Runtime:connect`](https://libtmux.org/en/lua/latest/reference/libtmux-runtime-connect/)
- Traversal from a server down to its panes: [`libtmux.Server:snapshot`](https://libtmux.org/en/lua/latest/reference/libtmux-server-snapshot/)
- Send keys to a pane: [`libtmux.Pane:send_keys`](https://libtmux.org/en/lua/latest/reference/libtmux-pane-send_keys/)
- Watch for changes through tmux control mode: [`libtmux.Observation:watch_notifications`](https://libtmux.org/en/lua/latest/reference/libtmux-observation-watch_notifications/)
- Capture pane contents: [`libtmux.Pane:capture`](https://libtmux.org/en/lua/latest/reference/libtmux-pane-capture/)
- Arguments passed as a list, with no shell quoting: [`libtmux.Server:command`](https://libtmux.org/en/lua/latest/reference/libtmux-server-command/)

- [Guides](https://libtmux.org/en/lua/latest/guides/): Task guides for Lua.
- [Topics](https://libtmux.org/en/lua/latest/topics/): Subject-by-subject, with Lua in every code block.
- [Examples](https://libtmux.org/en/lua/latest/examples/): Complete programs, sourced from the code each port tests.
- [API reference](https://libtmux.org/en/lua/latest/reference/): Types and functions of the Lua API.
