# tmux.NewSparseArray

- **Module:** tmux
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/sparse_array.go#L35
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-newsparsearray/

```
tmux.NewSparseArray(entries: SparseEntry[T]) -> (SparseArray[T], error)
```

NewSparseArray builds an array from entries, sorting them by index. It returns errors matching [ErrInvalidSparseIndex] or [ErrDuplicateSparseIndex] for negative, overflowing, or duplicate indices.
