Psych Engine Logo
Psych Engine - Lua Script API

Text Functions

Functions to display text on screen.


makeLuaText

makeLuaText(tag:String, ?text:String = '', ?width:Int = 0, ?x:Float = 0, ?y:Float = 0):Void

Creates a Lua Text and store it as the name input in "tag".

Examples:

Note: You will still have to add the Lua Text to the scene with addLuaText or it won't be visible.


addLuaText

addLuaText(tag:String):Void

Adds a previously created Lua Text to the top of the scene.

Examples:


removeLuaText

removeLuaText(tag:String, ?destroy:Bool = true):Void

Removes a previously added Lua Text.

Examples:


setTextString

setTextString(tag:String, text:String):Bool

Changes a Text's string.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextSize

setTextSize(tag:String, size:Int):Bool

Changes a Text's Font size.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextWidth

setTextWidth(tag:String, width:Float):Bool

Changes a Text's max width per line (in pixels).
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextHeight

setTextHeight(tag:String, height:Float):Bool

Changes a Text's max height (in pixels).
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextAutoSize

setTextAutoSize(tag:String, value:Bool):Bool

Changes a Text's Auto Size property.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextBorder

setTextBorder(tag:String, size:Float, color:String, ?style:String = 'outline'):Bool

Changes a Text's Border properties.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextColor

setTextColor(tag:String, color:String):Bool

Changes a Text's color.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextFont

setTextFont(tag:String, font:String):Bool

Changes a Text's font.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextItalic

setTextItalic(tag:String, italic:Bool):Bool

Toggles Italic in a Text.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


setTextAlignment

setTextAlignment(tag:String, ?alignment:String = 'left'):Bool

Changes a Text's Alignment.
Returns true if the operation was successful, throws an error if text object is missing and returns false.

Examples:


getTextString

getTextString(tag:String):String

Returns the Text's string.
Throws an error if the text object is missing and returns null.

Examples:


getTextSize

getTextSize(tag:String):Int

Returns the Text's font size.
Throws an error if the text object is missing and returns -1.


getTextFont

getTextFont(tag:String):String

Returns the Text's font path.
Throws an error if the text object is missing and returns null.


getTextWidth

getTextWidth(tag:String):Int

Returns the Text's max width.
Throws an error if the text object is missing and returns 0.


luaTextExists

luaTextExists(tag:String):Bool

Returns if a Lua Text with a specific tag exists.