Feedback
- press ENTER to search or ESC to cancel
Table of content
Globals namespaces
Constants
- Align
- AniDir
- BlendMode
- BrushPattern
- BrushType
- ColorMode
- FilterChannels
- Ink
- MouseButton
- MouseCursor
- RangeType
- SelectionMode
- SpriteSheetDataFormat
- SpriteSheetType
- WebSocketMessageType
Classes/objects
- Brush
- Cel
- Color
- ColorSpace
- Dialog
- Editor
- Events
- Frame
- GraphicsContext
- Image
- ImageSpec
- KeyEvent
- Layer
- MouseEvent
- Palette
- Plugin
- Point
- Properties
- Range
- Rectangle
- Selection
- Site
- Size
- Slice
- Sprite
- Tag
- Tile
- Tileset
- Timer
- Tool
- TouchEvent
- Version
- WebSocket
- Window
json
Since Aseprite v1.3-rc5 you have this json
global namespace. It
provides a couple of functions to decode JSON objects from strings to
Lua objects/tables and viceversa.
json.decode()
local jsonObj = json.decode(jsonText)
Parses the given jsonText
and returns a Lua table-like object
jsonObj
that represents the given data.
Examples:
local obj = json.decode('{"a":true,"b":5,"c":[1,3,9]}')
assert(#obj == 3)
assert(obj.a == true)
assert(obj.b == 5)
assert(#obj.c == 3)
assert(obj.c[1] == 1)
assert(obj.c[2] == 3)
assert(obj.c[3] == 9)
json.encode()
local text = json.encode(luaTable)
local text = json.encode(jsonObj) -- same as tostring(jsonObj)
Converts the given Lua-table into a JSON text.
Example:
local text = json.encode({ a=4, b=true, c="name", d={1,8,{a=2}} })
assert(text == '{"a": 4, "b": true, "c": "name", "d": [1, 8, {"a": 2}]}')