# `WardrikLua.Sandbox.Limits`

Bounds for one evaluation.

    WardrikLua.Sandbox.Limits.new(timeout_ms: :timer.seconds(5), max_steps: 1_000_000)

| Field | Default | Bounds |
| --- | --- | --- |
| `:timeout_ms` | 30s | how long the evaluation may run |
| `:max_heap_bytes` | 64 MB | memory the evaluating process may hold |
| `:max_steps` | 10M | operations the code may execute |
| `:max_depth` | 200 | nested calls the code may make |

Set any field to `:infinity` to lift that limit.

# `limit`

```elixir
@type limit() :: pos_integer() | :infinity
```

A bound, or `:infinity` for none.

# `t`

```elixir
@type t() :: %WardrikLua.Sandbox.Limits{
  max_depth: limit(),
  max_heap_bytes: limit(),
  max_steps: limit(),
  timeout_ms: limit()
}
```

Bounds for one evaluation.

# `new`

```elixir
@spec new(keyword()) :: t()
```

Returns limits, with defaults for fields not given.

Raises `KeyError` on an unknown field, and `ArgumentError` on a bound that isn't a positive
integer or `:infinity`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
