run_lua
Execute custom Aseprite Lua code against a sprite in a safe, undoable transaction to automate edits, inspect artwork, and return JSON data or inline previews.
Instructions
Execute custom Aseprite Lua code against a sprite inside a staged snapshot or live app.transaction (safe & undoable). Globals sprite, ops, and args are available; return any JSON-serializable value.
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": {
"file": "<file>",
"code": "<code>"
},
"name": "run_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Lua code to run against `sprite`. | |
| file | Yes | ||
| label | No | Journal label for this script. | |
| params | No | Optional table exposed as `args` in Lua. | |
| preview | No | Return an inline PNG preview in the same Aseprite call (true or options object). |