# LibTmux.Control.Request.field/2

- **Module:** LibTmux.Control
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/5bacf40788b43a5af27bb3656e727a921ba2db40/lib/libtmux/control/request.ex#L21
- **Page:** https://libtmux.org/en/elixir/pr-173/reference/libtmux-control-request-field-2/

```
field(variable, target \\ nil)
@spec field(String.t(), LibTmux.Ref.t() | nil) :: t()
```

Reads a named format variable, optionally from an exact instance-bound target.

Existing empty fields succeed. A target that disappears before the read
produces an acknowledged failed operation and leaves the connection usable.
A reference does not reserve the object's lifetime.

See the [worked example](managed-control.html).

## Parameters

- `variable` (`String.t()`)
- `target` (`LibTmux.Ref.t() | nil`)
  Default: `nil`.
