# pxstud.io Lua scripting API — Reading the document

> 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.

## Reading the document
Every field of the document model and how a script reads it. Pixel data is never part of a structural read; it comes from the bulk pixel functions.

- **Sprite**: id; width; height; colorMode (ColorMode); palette; paletteChanges via app.getPalette; colorCycles via app.getColorCycles; paletteGroups; paletteLock; colorDepth; transparentIndex; pixelRatio; userData; layers via app.getLayers; frames via app.getFrames; cels via app.getCels; tags via app.getTags; slices via app.getSlices; tilemapInstances via app.getTilemap; tilemapCels via app.getCels; referenceTransforms via app.getReferenceTransform; contentLinks via app.getLinkedFrames; grid (not read: editor view setting (Grid Settings dialog) — scripts see the artwork, not the overlay); guides (not read: editor view setting (View > Guides) — scripts see the artwork, not the overlay); perspective (not read: editor view setting (View > Perspective Grid) — scripts see the artwork, not the overlay)
- **Layer**: id; name; type (LayerType); parentId; collapsed; isolated; opacity; visible; locked; movementLocked; background; clipped; draft; continuous; effects; blendMode (BlendMode); userData; referenceSource as reference ({ width, height } of the imported image; its pixels aren't readable); tileset as tileset ({ tileWidth, tileHeight, tileCount, matchFlipH, matchFlipV, matchRotate, baseIndex, name?, id? }; tile images via app.getTilePixels)
- **Frame**: id; order as index (0 = first frame); durationMs; color; locked
- **Cel**: layerId; frameId; x; y; width; height; opacity; zIndex; link as linkedTo (the frame whose image a linked cel shares); userData; pixels (not read: pixel data — read it with app.getImage); text (not read: the Text tool's editable text, drawn with the editor's fonts; scripts see its pixels); tween (not read: the tween span starting at this keyframe (the editor's recipe); scripts see the in-betweens' pixels); generated (not read: marks an in-between a tween wrote; scripts see it as an ordinary cel)
- **Tag**: id; name; fromFrameId; toFrameId; color; direction (TagDirection); repeat; userData
- **Slice**: id; name; x; y; width; height; center; pivot; keys as keyFrameIds (frame ids that start a new key (bounds, centre and pivot change from there on); x, y, width, height, center and pivot are the key in effect on the frame asked for (app.getSlices(frameId)), else the first frame's); userData
- **Tileset**: tileWidth; tileHeight; tiles as tileCount (each tile's image via app.getTilePixels); matchFlipH; matchFlipV; matchRotate; id; name; baseIndex; userData; tileUserData (not read: per-tile user data, kept from .aseprite files; no script command reads or sets it yet)
- **Tile placement**: x; y; tileIndex; flipH; flipV; rotate90
- **Reference placement**: layerId; frameId; x; y; width; height
- **Selection**: bounds; mask via app.getSelectionMask
