run_lua
Execute custom Lua scripts inside Aseprite to automate pixel art edits, query canvas data, and return JSON results as a single undoable step.
Instructions
Run arbitrary Lua inside Aseprite and return its result (advanced escape
hatch — equivalent to local code execution). J(value) is available for
JSON returns; wrap your own edits in app.transaction for clean undo.
The prelude also provides editCel(fn) and findLayer(s, name). Set
save=true (headless) to persist changes to file. Your code must
return a value. Set edit=true when the code only edits the active
sprite: it then runs as one undo step, under the pixel cap and dry run. Without
edit the rails don't apply, and in a dry run this tool refuses to run.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "run_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| edit | No | ||
| file | No | ||
| save | No |