Introduction



The scripting interface in Moho (Anime Studio) is divided into three "modules":

LM is the lowest-level module, and includes very basic objects like vectors and colors.

LM.GUI is a user interface module that is built on top of Moho's cross-platform user interface library. Scripts can use the user interface widgets in this module to build dialog boxes, and to set up custom interfaces for toolbar buttons.

MOHO is the module that is a direct interface into Moho itself. The objects and functions in the MOHO module allow scripts to create and manipulate layers, vector artwork, bone systems, and more.

Creating objects: When a script creates new objects in Moho, it will most often not create them directly, but call a function to do the job. For example, a script never creates a new layer object directly, but tells Moho to insert a new layer:
-- *** Ask Moho to create a new vector layer ***
local layer = moho:CreateNewLayer(MOHO.LT_VECTOR)


The only cases where a script will directly create a new object is for very simple object types, like points, vectors, and colors. For example, to create a new 2D vector object, a script might do the following:
-- *** Create a new local variable ***
local vec = LM.Vector2:new_local()


-- *** Create a new global variable ***
gVec = LM.Vector2:new()