# server.settings.Server.array_option

- **Module:** server.settings.Server
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/server/settings.rs#L306
- **Page:** https://libtmux.org/reference/rs/server-settings-server-array_option/

```
server.settings.Server.array_option(self, name: &str) -> Result<SparseValues<TmuxText>, Error>
```

Read every value an array option holds, by index.

Some tmux options hold a numbered set rather than one value:
`command-alias` and `terminal-overrides` are the common ones, and every
hook is one too. The indices are sparse and tmux keeps the gaps, so
this reports them rather than a list. An empty result means the option
holds nothing.

# Errors

Returns an error when tmux does not recognize the option name.

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();

// Written far apart on purpose: nothing renumbers, so the gap stays.
server.set_array_option("command-alias", 30, "thirty=display -p 30").await?;
server.set_array_option("command-alias", 35, "five=display -p 35").await?;

let aliases = server.array_option("command-alias").await?;
assert_eq!(aliases.get(31), None, "the gap is tmux's, and it is kept");
assert_eq!(
    aliases.get(35).map(|value| value.to_string_lossy().into_owned()),
    Some("five=display -p 35".to_owned()),
);

server.unset_array_option("command-alias", 35).await?;
assert_eq!(server.array_option("command-alias").await?.get(35), None);

guard.shutdown().await?;
```
