We will try minimize API changes between versions and keep backward compatibility, but if a function in the API was introduced with a bug, it's probable that its behavior will change in the next Aseprite release.
Deprecated should be avoided because might be removed in future versions of Aseprite.
You can use app.apiVersion:
if app.apiVersion == nil then
-- First scripting API available
app.alert("This is Aseprite v1.2.10-beta1 or v1.2.10-beta2")
elseif app.apiVersion == 1 then
-- Second revision of the scripting API
app.alert("This is Aseprite v1.2.10-beta3")
else
-- Future versions will be 2, 3, etc.
endapp.apiVersionis36- Added
uiparameter to all commands for enabling/disabling user interaction through their dialogs #3025
app.apiVersionis36- Enclose key names for plugin preferences with
["..."]when it's required #5412
app.apiVersionis35- Added
sprite.undoHistory#5205 - Added
resizeableproperty toDialogconstructor #5177 - Added
oncheckedparameter to Plugin:newCommand() #5198 - Added missing
FlipType.DIAGONAL#5359 - Added
app.tip#5316 #5348 - Added
autofitandsizeHintproperties to Dialog #5176 - Refresh timeline when changing layer collapsed status #5366
- Process mnemonics consistently for plugins #5250
- Escape characters in the console that we can't show properly #5324
app.apiVersionis34- Added
eventsto listen toblendMode,name,opacityandvisibilitySprite layer changes #5164
app.apiVersionis33- Added
Dialog:separator()more in line with other widgets #4989 (thanks to @MapleGecko) - Added uuid field to layers #5033
- Added
os.rename()andos.remove()functions - Added
fitCriteriaparameter toapp.command.ChangePixelFormatcommand #4781 - Fixed
cel.image:clear()cannot be undone #5015 - Fixed regression overwriting path specified in
Dialog:file{filename}#5061
app.apiVersionis32- New
app.clipboardAPI #2073 - New
beforesitechangeevent #4785 - New
plugin.versionandplugin.displayNameproperties #4904 - Don't allow to set invalid pixel ratios for sprites #3285
- Fixed
Image:drawImage()whenBlendMode.SRCis used #5001
app.apiVersionis31- Fixed
cel.image = nilstatement #4514 - Added
uiparam toapp.command.MaskByColor#2774
app.apiVersionis30- Added
GraphicsContextfor images:Image.contextproperty #4330 - Added
ui/flatten/filenameparameters toapp.command.DuplicateSpritecommand #4755
app.apiVersionis30- Added
app.editor.zoom/scrollproperties #4722 - New option (
Dialog:show{ hand=true }) to enable Hand tool in the active editor with a modal dialog (thanks to @lampysprites)
app.apiVersionis29- New
fgTile/bgTileproperties to get/set the foreground/background tile #4403 - Added
Site.tilemapModeproperty - Added
xandyparams toapp.command.Paste() - Fixed
app.command.Cut/Pastein-batchmode #4354 - Fixed
app.command.Cancel()command when used from scripts - Fixed default
color/bgColorparams inapp.useTool()
app.apiVersionis28- New
app.oswith some properties about the running platform - New
recentparameter to SaveFile and ExportSpriteSheet commands
app.apiVersionis27- Fixed some bugs using tabs widget #4288, #4268
app.apiVersionis26- New
Dialog:tab()/endtabs()widget - New
Dialog:show{ autoscrollbars=true }parameter - New
app.editor:askPoint{ decorate={ rulers=true, dimmed=true } }options - New
Alignenum - New
Image.bytesPerPixelproperty
app.apiVersionis25- Removed
App.events'beforepaintemptytilemap' - New
app.windowobject. - New integrated
json.decode()andjson.encode()functions.
app.apiVersionis24- New
Image:flip()function andFlipType - New
App.events:'beforecommand','aftercommand','beforepaintemptytilemap'
app.apiVersionis23- New
require()function - New
app.editorandEditorobject - New
plugin.nameandplugin.pathproperties - New
Cel.zIndexproperty - New
Uuidclass - New
image:clear(bounds, color)variant (we can specify a Rectangle to clear) - New short property names for active objects: app.sprite (same as app.activeSprite), app.layer/frame/cel/tag/tool/brush
- New width/height short names for Rectangle.w/h and Size.w/h
- New
gridBoundsparameter toapp.command.NewLayer
app.apiVersionis22- New
app.uiScaleproperty - New
app.theme:styleMetrics()function - New
plugin:newMenuGroup()andplugin:newMenuSeparator()functions - New
Size:union()function - New GraphicsContext.opacity/blendMode properties
- New GraphicsContext:oval() function
- Renamed
KeyEvent:repeattoKeyEvent:repeatCount - New
ondblclickevent for Dialog:canvas() widget
app.apiVersionis21- New
evargument forSprite.events:on('change', ...)callback to detect if the change is from an undo/redo change (related to #3539) - New AniDir.PING_PONG_REVERSE field
- New Tag.repeats field
- New Sprite.isModified property
- New Image.bounds property and Image:shrinkBounds() function
- New app.theme class
- New Dialog:canvas() widget
- New GraphicsContext class
- New Rectangle.origin and Rectangle.size properties
- New Tile and new Sprite:newTile()
- New Timer class
- New properties field for several objects
app.apiVersionis20- Added app.range.slices object
- Only in v1.3-beta21:
- Added
boundsparameter to app.command.SaveFileCopyAs command - Added
splitGrid&fromTilesetsparameters to app.command.ExportSpriteSheet command
- Added
app.apiVersionis19- Fixed several issues with app.command.SaveFile/SaveFileAs/SaveFileCopyAs commands
- Fixed Sprite:newSlice, now it adds undo information
app.apiVersionis18- Now
Dialog()returnsnilif we are running in-batchmode - New
Cel.frame/Cel.frameNumbersetters - Comparing
Layers withSprites just return false #3218
app.apiVersionis17- New
Color{ index } - Now
Color.indexreturns an integer instead of a number
app.apiVersionis16- New
filenamechangeevent forSprite.events - Possibility to change
optionsfield forDialog:combobox()fromDialog:modify()
app.apiVersionis15- New
onenabledattribute forplugin:newCommand() - New
App.eventsandSprite.eventsproperties, andEventsclass - New
Image.bytesandImage.rowStrideproperties - New
WebSocketclass andWebSocketMessageTypeconstants - New
Layer.isReferenceproperty
app.apiVersionis14- Added
selectionargument toapp.useTool{}to use selection tools - New
SelectionMode - In v1.3-beta1
- New
Layer.isTilemap - New
Tileset
- New
app.apiVersionis13- New
app.fs.makeDirectory/app.fs.makeAllDirectories/app.fs.removeDirectoryfunctions to manipulate directories - Added
Sprite.pixelRatioproperty - Added
app.command.ImportSpriteSheet.
app.apiVersionis12- New
app.command.CanvasSize()params (uiandbounds) - Fixed crash undoing
Sprite:newCel()in background layer - Fixed
Dialog oncloseevent, now it's called when we close the app and the dialog is still opened #28 - API changes:
- You must use
Dialog:newrow{ always=true }to activate the automatic "newrow" (Dialog:newrow{ always }cannot be used) - You must use
ColorSpace{ sRGB=true }to create an sRGB color space (ColorSpace{ sRGB }cannot be used) - Now
app.command.SetInkType{ type=... }works
- You must use
app.apiVersionis11- Added support to modify more properties with
Dialog:modify{}(PR#2359, separator text #27) - Added some extra
onchangeandonreleaseevents for some widgets likeDialog:slider{}(PR#2359) - Added more arguments (
bgColor,ink,button,opacity,contiguous,tolerance,freehandAlgorithm) toapp.useTool{} - New Ink constants
app.apiVersionis10- New
Tag.colorproperty - New
MouseButtonwhich enumerates possible values for the newev.buttonvalue of theDialog:shades{ onclick }widget callback - New
Dialog:modify{}method to change widget properties dynamically - New
Dialog:newrow{ always=true }variant - New
Range:clear()function - New
Range.layersandRange.framessetters
app.apiVersionis9- New
app.fswith several functions to handle filenames and paths - New
Dialog{ onclose }constructor with a table with fields liketitleandonclose - New
Dialog:shades{}widget - New
Image:saveAs{ filename, palette }function
app.apiVersionis8- Fixed
Layer.stackIndexsetter when the number we use is higher than the currentstackIndexof the layer - Now
app.preferences.document(nil)returns the default preferences for documents
app.apiVersionis7- Added
Sprite.gridBoundsproperty
app.apiVersionis6- Fixed
Sprite:resize(): Now it can resize the non-active sprite. - Fixed
Sprite:newTag(): Adds undo information (can be used inside a transaction now).
app.apiVersionis5- Added filter commands:
- New types:
- Added support to convert arrays of 2 or 4 integers into points, sizes, and rectangles.
- Added
Range.colorsandRange.containsColormembers. And new commandsCopyColors/MoveColors. - Added
Image:resize()function. - Changed
Sprite:resize()behavior: resizes the sprite and images (not only the canvas). Sprite.layersreturns only the first level of layers (in previous versions it returned all the layers, even sublayers inside groups).- New
Layer.layersproperty to get the layer groups - Possibility to change
Layer.parentproperty - New
Layer.stackIndexproperty to reorder layers
app.apiVersionis4app.useTool()now can be used inside aapp.transaction()(#18)- New params for
app.command.NewFile.
app.apiVersionis3app.versionis anVersionobjectSprite- Added
sprite:close()function - Added
sprite:assignColorSpace()andsprite:convertColorSpace() - Now
sprite:saveAs()changes the state of the sprite as a saved document - Now you can set
sprite.filenameproperty
- Added
- New
ColorSpaceclass. - New
focusproperty for Dialog:button and Dialog:entry. - New parameters for
ExportSpriteSheet. - New
app.useTool(),Brush,Toolclass.
app.apiVersionis2- Fixed
app.spritestable - Added
app.paramstable
app- New
app.apiVersionwith value1. - Different return value for
app.activeFrame: Now it returns aFrameinstead of a frame number (an integer value). In v1.2.10-beta2 this function returnednilwhen we were in the first frame, now it returns the validFrameobject withframe.frameNumber = 1. You can access the old frame number value doing:local activeFrameNumber = app.activeFrame.frameNumber
- New
app.range
- New
Site- Different return value for
app.site.frame: Now it returns aFrameinstead of a frame number.
- Different return value for
Rectangle- Added
Rectangle.containsfunction. - Added
Rectangle.intersectfunction. - Added
Rectangle.intersectsfunction. - Added
Rectangle.unionfunction.
- Added
Sprite- Added
Sprite.boundsproperty. - Different
Sprite:newFrameandSprite:newEmptyFramebehavior (check documentation and issue #4).
- Added
Image- Added
Image:clear()function. - Added
Image:isEqual,Image:clear. - Added
Image:drawPixelas an alias forImage:putPixel(both functions will be available). - Deprecated
, replaced withImage:putImageImage:drawImage. - Deprecated
, replaced withImage:putSpriteImage:drawSprite. AlsoImage:putSpritewasn't working correctly for positions !=0,0.
- Added
ColorMode:- Deprecated
, replaced withColorMode.GRAYSCALEColorMode.GRAY.
- Deprecated
Tag:- Different return value for
Tag.fromFrameandTag.toFrame: now they return aFrameobject instead of an integer value.
- Different return value for
- All functions that receive an integer can automatically accept
floating numbers doing an implicit
math.floor(number)conversion.
appapp.apiVersiondidn't exist (isnil)