# The Lua console

Running Lua interactively inside Zene Studio.

Source: https://zenestudio.org/docs/scripting/console

Markdown version of the Zene Studio page at https://zenestudio.org/docs/scripting/console. For a map of the whole site, see
https://zenestudio.org/llms.txt.

---
The Lua console is an interactive prompt inside Zene Studio. It is the fastest way to find out what
the [Lua API](/docs/scripting/lua-api) can actually do **in the build you are running**.

## Opening it

The console is part of the scripting interface — look for it in the scripting menu.

## Using it

Type Lua and press Enter. Expressions return their value; multi-line blocks work as you would expect
in Lua.

```lua
-- What version of the API am I on?
print(API_VERSION)

-- What tracks exist right now?
for _, track in ipairs(project.tracks) do
  print(track.name)
end
```

:::note
The exact names of API globals depend on your build. Use the console to **discover** them. Do not
trust a snippet from a forum post written against a different version. This is exactly what the
[compatibility policy](/docs/scripting/compatibility-policy) is for.
:::

## Why use the console

- **Verify before you script.** Check that a field exists before writing a script that depends on it.
- **Explore interactively.** Poke at a project, see what comes back, then turn it into a script.
- **Debug a script device** without a rebuild cycle.

## Console or socket?

| | Console | Socket |
| --- | --- | --- |
| Scope | Inside the application | Any process |
| Feedback loop | Immediate | Requires a client |
| Good for | Exploring, debugging | Automation, agents, tooling |

For anything you want to run repeatedly, promote it to a script instead of retyping it.

## Script devices

Once you know what the API offers, the natural next step is a **script device**: an instrument or
effect implemented in Lua that travels inside your project. See
[Lua API](/docs/scripting/lua-api#script-devices).