ScriptInterface:InsertText(textParams, lineOffset)

Version added: before 9.5

Creates a new text object

ArgumentTypeDescriptionDefaultVer
textParamsInsertTextParamsSee InsertTextParams description< 9.5
lineOffsetint32< 9.5

Return type : none

typedef struct {
int32 Font;
LM_String FontName;
LM_String Text;
int32 Justification;
bool Fill;
bool Stroke;
bool OneFill;
bool CenterH;
rgb_color LineCol;
rgb_color FillCol;
real LineWidth;
int32 Leading;
int32 Kerning;
bool MakeLayer;
LM_String BalloonStyle;
bool BalloonFill;
bool BalloonStroke;
int32 BalloonSize;
real BalloonLineWidth;
rgb_color BalloonLineCol;
rgb_color BalloonFillCol;
bool BalloonSizeProportional;
LM_String BalloonPoses;
int32 TextSize;
bool BalloonFlipV;
bool BalloonFlipH;
} InsertTextParams;

Adding text to a mesh layer:
local param = MOHO.MohoGlobals.InsertText
param.Text:Set("Hello")
param.OneFill = true
moho:InsertText(param, 0)

Creating a new text layer:
local param = MOHO.MohoGlobals.InsertText
param.Text:Set("Hello")
moho:CreateNewLayer(MOHO.LT_TEXT)
moho:InsertText(param, 1000)

Invokes insert text dialog, populated with the setting set in param:
local param = MOHO.MohoGlobals.InsertText
param.Text:Set("Hello")
param.MakeLayer = true --only works for moho:CreateTextObject()
moho:CreateTextObject()

Convert text layer to vector layer:
local layer = moho.layer --text layer
moho:CreateNewLayer(MOHO.LT_VECTOR)
local param = MOHO.MohoGlobals.InsertText
param.Text:Set(layer:Name())
moho:InsertText(param, 0)
moho:DeleteLayer(layer)