# LibTmux.Control.Request.field/2

- **Module:** LibTmux.Control
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/66b9b1c3f3f3186428abdfda2c76f5cf87446710/lib/libtmux/control/request.ex#L21
- **Page:** https://libtmux.org/en/elixir/latest/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`)
