# pxstud.io Lua scripting API — Stays in the editor

> Part of the pxstud.io Lua scripting reference, whose overview (https://pxstud.io/docs/scripting.md) explains its conventions. The option groups and types it refers to are in https://pxstud.io/docs/scripting/option-groups.md and https://pxstud.io/docs/scripting/types.md. Everything in one file: https://pxstud.io/llms-full.txt. The whole site's index: https://pxstud.io/llms.txt.

## Stays in the editor
The engine owns the document and the editing context. What's left is the editor's own: how you look at your work, and the app around it.

- **View: zoom, pan, grids, tiled view, onion skin.** How the canvas is shown, not what's on it.
- **Panels and layout.** Window chrome; there's nothing for a headless engine to show.
- **Playback.** Previewing the animation. Frame durations and tags are scriptable.
- **Clipboard.** App-level and not undoable. Scripts copy with app.getImage / app.putImage and app.moveCels / app.linkCels.
- **Open sprites, projects, sprite names, saving and export.** App-level and irreversible, so a shared script can't close, delete or overwrite your work. A script edits the open sprite, as one undo step.
- **Importing reference images.** A file picker. Reference layers can still be read and repositioned.
- **The saved brush and palette libraries.** What you saved to your account; the engine can't see them, so a script gets one only when its config form asks and you pick it (brush and palette fields). Scripts also define their own brushes in the engine (app.defineBrush) — those aren't saved or added to the library.
- **The active tool.** In the engine the tools are commands (app.drawStroke, app.floodFill, …).
