Skip to content
Nibbl-z edited this page Aug 10, 2024 · 1 revision

Labels are UI elements that contain text. You can change the font, text size, alignment, and color.

Creation

To create a Label, call yan:Label(screen, text, textSize, horizontalAlignment, verticalAlignment, fontPath). This will return a Label instance.

screen : Screen

The screen to put the Label under.

text : string

The text to put in the Label.

textSize : number

The size of the text.

horizontalAlignment : AlignMode ("left" | "center" | "right" | "justify")

The alignment of the text on the X axis.

verticalAlignment : "top" | "center" | "bottom"

The alignment of the text on the Y axis.

fontPath : string (optional)

The path of the font to use on the Label.

Properties

Text : string

The text to put in the Label.

Align : AlignMode ("left" | "center" | "right" | "justify")

The alignment of the text on the X axis.

VerticalAlign : "top" | "center" | "bottom"

The alignment of the text on the Y axis.

Note: Text Size and Font cannot be changed after creation as of now.

Example

local label1 = yan:Label(MainMenu, "Hello Yan!", 32, "center", "center")
local label2 = yan:Label(MainMenu, "I love music!", 16, "left", "top")

label2.Text = "I love the stars!"