Text Functions - SmallSquareStudios/Psych-Engine-Wiki-Extra GitHub Wiki

If you are wanting to add quotations in your lua text, you can do "'this'".

Adding/Removing Text

makeLuaText(tag:String, text:String, width:Int, x:Float, y:Float)

Creates a lua text object with the text, width, and position specified.

tag - The name of the lua text.

text - The text the lua text will show.

width - The amount of pixels it takes for a line break.

x - The x position of the text.

y - The y position of the text.

addLuaText(tag:String, ?front:Bool)

Adds the lua text onto the stage.

tag - The name of the lua text to be added onto the stage.

front - Optional, if true, adds the text to the front part of the camera.

removeLuaText(tag:String, ?destroy:Bool)

removes the lua text from the stage.

tag - The name of the lua text to be removed from the stage.

destroy - Optional, if true, the lua text will be removed from the memory. You will need to use makeLuaText again to add it back.

Setting/Getting Functions

setTextString(tag:String, text:String)

Sets the text of a lua text.

If you want to add variables into your text, you can do something like this: setTextString('tag', 'health: ' .. getProperty('health') .. '%'.

getTextString(tag:String)

Gets the text of a lua text.

getTextWidth(tag:String)

gets the amount of pixels it takes for a line break.

setTextWidth(tag:String, width:Int)

Sets the amount of pixels it takes for a line break.

width - The amount of pixels it takes for a line break.

getTextColor(tag:String)

gets the color of a lua text.

setTextColor(tag:String, color:String)

Sets the color of a lua text.

color - The color of the specified text, must be a hexadecimal such as "FFFFFF" or "000000".

getTextSize(tag:String)

gets the size of a lua text.

setTextSize(tag:String, size:Int)

Sets the size of a lua text.

size - The size of the text.

setTextBorder(tag:String, size:Int, color:String)

Sets the border of a lua text, with a specified size and color.

size - The thickness of the border.

color - The color of the text border, must be a hexadecimal such as "FFFFFF" or "000000".

getTextFont(tag:String)

Gets the font of a lua text.

setTextFont(tag:String, font:String)

Sets the font of a lua text.

font - The font of the text. Must include the extension such as "font.ttf" or "font.otf".

setTextAlignment(tag:String, alignment:String)

Sets the alignment of a lua text.

alignment - The alignment of the text. Can be either left, right, or center.

setTextItalics(italics:Bool)

Sets the lua Text's italics.

italics - The italics of the lua text.