# `AshLua.Runtime`
[🔗](https://github.com/ash-project/ash_lua/blob/v0.1.0/lib/ash_lua/runtime.ex#L5)

Builds a Lua VM with Ash action bindings derived from `Ash.Info.Manifest.generate/1` and
dispatches calls through to Ash with consistent actor / tenant / context plumbing.

## Lua surface

    local user, err = accounts.user.create({ name = "Zach" })
    assert(accounts.todo.complete({ id = todo.id }))      -- raises on error

Action callables always return `(result, nil)` on success and `(nil, err_table)` on failure;
wrap a call in `assert()` for raise semantics.

Actor, tenant, and context are host-supplied via the eval opts and are never reflected to or
mutable from the script.

# `build`

```elixir
@spec build(keyword()) :: Lua.t()
```

Builds a `%Lua{}` VM with Ash bindings installed.

## Options

  * `:otp_app` (required) — passed through to `Ash.Info.Manifest.generate/1`.
  * `:actor`, `:tenant`, `:context` — host-supplied; merged into every Ash call.
  * `:manifest` — pre-built `%Ash.Info.Manifest{}` (skips regeneration).
  * `:lua` — pre-built `%Lua{}` to install bindings on. Defaults to `Lua.new/0`.

# `eval!`

```elixir
@spec eval!(
  String.t(),
  keyword()
) :: {list(), Lua.t()}
```

Evaluates a Lua script string against a VM built from `opts`.

Returns `{results, lua}` like `Lua.eval!/2`.

---

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