Lua Scripting
Lua is Plinken’s universal scripting layer. Like Python in Houdini or ExtendScript in After Effects, Lua gives you programmatic control over every part of the application — the DAW engine, media pipelines, and the 3D scene graph.
Plinky, the built-in AI assistant, uses the same Lua API described here. Anything you script by hand, Plinky can generate and execute.
Three Surfaces
Section titled “Three Surfaces”Lua code runs in three contexts, each suited to a different task:
| Surface | Purpose | Entry Point |
|---|---|---|
| Actions | Immediate scripts — automate the DAW, call commands, run external tools | Action Editor or lua:execute command |
| Workflows | DAG pipelines — chain nodes for media generation, AI processing, batch export | Workflow Editor or lua-workflow:run command |
| Scene | 3D scene graph — create meshes, lights, cameras, animate characters | pl.scene global |
The plinken Global
Section titled “The plinken Global”Every Lua script has access to the plinken global object. This is the root of the entire API.
DAW & Runtime
Section titled “DAW & Runtime”| Function | Returns | Description |
|---|---|---|
pl.cmd(id, payload) | — | Execute any DAW command (deferred to next frame) |
pl.log(msg) | — | Output a message to the console |
pl.sleep(ms) | — | Yield execution (max 30 000 ms) |
pl.get_context() | table | Session context — account, project, space, team, video |
pl.get_transport() | table | Transport state — tempo, playing, position, time signature |
plinken.list_commands() | table | All registered command IDs |
pl.exec(program, args) | string | Run an allowlisted external program |
plinken.allowed_programs() | table | List of programs available to exec |
print(...) | — | Redirected to the script output buffer |
| Property | Type | Description |
|---|---|---|
pl.scene | Scene | Entry point to the 3D Scene API |
See the Actions reference for full details on every function, and the Scene API for the 3D subsystem.
Quick Start
Section titled “Quick Start”Open the Action Editor (from the Action menu) and paste:
-- Log the current session infolocal ctx = pl.get_context()pl.log("Project: " .. ctx.project)
-- Check transport statelocal transport = pl.get_transport()pl.log("Tempo: " .. transport.tempo .. " BPM")
if transport.playing then pl.cmd("transport:stop", {}) pl.log("Stopped playback")else pl.cmd("transport:play", {}) pl.log("Started playback")endPress Run (or execute via lua:execute) to see the output in the console.
Plinky & Lua
Section titled “Plinky & Lua”Plinky, Plinken’s AI assistant, writes and executes Lua behind the scenes. When you say “mute all drum tracks” or “set up three-point lighting”, Plinky translates that into Lua calls against the same plinken API.
This means:
- Any script you write can be generated by Plinky
- Any Plinky action can be inspected as Lua source
- You can teach Plinky new workflows by writing reusable scripts
API Reference
Section titled “API Reference”- Actions — DAW commands, runtime API, external tools
- State Read-Back — Querying tracks, regions, selection, mixer, automation, and plugins
- MIDI Data Access — Read, write, and send MIDI data
- File I/O — Read and write files (sandboxed to project directory)
- HTTP / Network — Make HTTP GET and POST requests
- Events & Callbacks — React to DAW changes with persistent scripts
- Timers & Intervals — Schedule recurring and one-shot callbacks
- Workflows — Lua-driven DAG pipelines for media processing
- Scene (3D) — Full 3D scene graph control
- Nodes — Hierarchy and transforms
- Meshes — Geometry and morph targets
- Materials — PBR metallic-roughness
- Textures — Image loading
- Lights — Directional, point, spot, area
- Cameras — Perspective, orthographic
- Animation — Playback and timeline sync
- Skeleton — Joints and skinning
- Environment — Ambient, HDRI, fog
- Post-Processing — Bloom, tone mapping, SSAO
- Shadows — Shadow maps and cascades
- Render Settings — Anti-aliasing, debug stats
- Math Helpers — vec3, quat, mat4
- Raycasting — Picking and queries