# libtmux.WindowLink:swap

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

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

## Parameters

- `other` (`libtmux.WindowLink`):  One placement of a window in a session: a window can be linked into several.
- `options` (`libtmux.SwapLinkOptions?`)

## tmux command

The tmux commands behind `swap`.

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

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_swap_window_entry`](/en/tmux/latest/reference/c-variable-cmd_swap_window_entry/) (attribute)
- [`cmd_swap_window_exec`](/en/tmux/latest/reference/c-function-cmd-swap-window-c-cmd_swap_window_exec/) (function)

## In other ports

Exchange two windows

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.swap`](/en/py/latest/reference/libtmux-window-swap/) (method) |
| TypeScript | [`window.Window.swapWith`](/en/ts/latest/reference/window-window-swapwith/) (method) |
| Rust | [`window.Window.swap_with`](/en/rs/latest/reference/window-window-swap_with/) (method) |
| Go | [`tmux.Window.Swap`](/en/go/latest/reference/tmux-window-swap/) (method) |
| Java | no equivalent on `Window` |
| C# | [`LibTmux.Window.SwapAsync`](/en/csharp/latest/reference/libtmux-window-swapasync/) (method) |
| C++ | [`libtmux::Window::swap_with`](/en/cxx/latest/reference/libtmux-window-swap_with/) (method) |
| Swift | [`Server.swap(_:with:)`](/en/swift/latest/reference/server-swap(_-with-)/) (method) |

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