# libtmux.Pane:swap

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Lua
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-lua/blob/d68f829fe097e38dcbbf7147e276666fe615f0cf/lua/libtmux/_internal/entity.lua#L507
- **Page:** https://libtmux.org/en/lua/v0.1.1/reference/libtmux-pane-swap/

```
swap: fun(
  self: libtmux.Pane,
  other: libtmux.Pane,
  options?: libtmux.SwapPaneOptions,
):libtmux.Request<boolean>
```

## Parameters

- `other` (`libtmux.Pane`):  A tmux pane.
- `options` (`libtmux.SwapPaneOptions?`)

## tmux command

The tmux commands behind `swap`.

- [`swap-pane`](/en/tmux/latest/manual/swap-pane/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_swap_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_swap_pane_entry/) (attribute)
- [`cmd_swap_pane_exec`](/en/tmux/latest/reference/c-function-cmd-swap-pane-c-cmd_swap_pane_exec/) (function)

## In other ports

Exchange two panes

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.swap`](/en/py/latest/reference/libtmux-pane-swap/) (method) |
| Ruby | [`LibTmux::Pane#swap`](/en/ruby/latest/reference/libtmux-pane-swap/) (method) |
| TypeScript | [`pane.Pane.swapWith`](/en/ts/latest/reference/pane-pane-swapwith/) (method) |
| Rust | [`pane.Pane.swap_with`](/en/rs/latest/reference/pane-pane-swap_with/) (method) |
| Go | [`tmux.Pane.Swap`](/en/go/latest/reference/tmux-pane-swap/) (method) |
| Java | [`io.github.libtmux.Pane.swapWith`](/en/java/latest/reference/io-github-libtmux-pane-pane-swapwith/) (method) |
| C# | [`LibTmux.Pane.SwapAsync`](/en/csharp/latest/reference/libtmux-pane-swapasync/) (method) |
| C++ | [`libtmux::Pane::swap_with`](/en/cxx/latest/reference/libtmux-pane-swap_with/) (method) |
| Swift | `Server.swap(_:with:)` swaps windows, not panes |

No equivalent is recorded in PowerShell, Julia, Elixir, Kotlin, Scala or F#.
