class WorldLabel (client-side)
Available since version: 0.3.0
3D text drawing helper for rendering world-space text on screen.
Constructor
WorldLabel.new()
Parameters:
No parameters.
Constructor
WorldLabel.new(number x, number y, number z)
Parameters:
numberx: Initial X world position.numbery: Initial Y world position.numberz: Initial Z world position.
Constructor
WorldLabel.new(number x, number y, number z, string text)
Parameters:
numberx: Initial X world position.numbery: Initial Y world position.numberz: Initial Z world position.stringtext: Initial text line.
Properties
{x, y, z} position
World position {x, y, z}, projected onto the screen while rendering.
table lines
Dense one-based array of text lines. See getLines and setLines.
string font
Represents the font identifier used for rendering.
{r, g, b, a} color
Represents the WorldLabel color.
number alpha
Opacity from 0 (transparent) to 255 (opaque).
boolean visible
Represents whether the WorldLabel object is rendered.
number maxRenderDistance
Maximum distance from the local hero in world units; this is independent of the camera.
string text
Complete text as a newline-separated string. Reading and writing use the same representation.
Methods
setPosition
Sets the world position used to project this text to screen space.
void setPosition(number x, number y, number z)
Parameters:
numberx: X world position.numbery: Y world position.numberz: Z world position.
getPosition
Returns the current world position.
{x, y, z} getPosition()
Returns {x, y, z}:
Table containing x,y,z world position.
appendLine
Appends a text line to the WorldLabel object.
void appendLine(string text)
Parameters:
stringtext: Text line to append.
clearLines
Removes all text lines.
void clearLines()
getLines
Returns all text lines.
table getLines()
Returns table:
Array-like table of text lines.
setFont
Sets the font used for rendering.
void setFont(string font)
Parameters:
stringfont: Font file name.
getFont
Returns the current font file name.
string getFont()
Returns string:
Font file name.
setColor
Sets the text color.
void setColor(number r, number g, number b)
Parameters:
numberr: Red color component.numberg: Green color component.numberb: Blue color component.
getColor
Returns the text color.
{r, g, b, a} getColor()
Returns {r, g, b, a}:
Table containing color in RGBA model.
setAlpha
Sets the text alpha.
void setAlpha(number alpha)
Parameters:
numberalpha: Opacity value (0-255).
getAlpha
Returns the current alpha.
number getAlpha()
Returns number:
Opacity value (0-255).
setVisible
Sets whether the WorldLabel object should render.
void setVisible(boolean visible)
Parameters:
booleanvisible: True to render, false to hide.
getVisible
Returns whether this WorldLabel object is visible.
boolean getVisible()
Returns boolean:
True if visible.
setMaxRenderDistance
Sets the max render distance from the local player.
void setMaxRenderDistance(number distance)
Parameters:
numberdistance: Max distance in world units. Zero disables distance culling.
getMaxRenderDistance
Returns the max render distance.
number getMaxRenderDistance()
Returns number:
Max distance in world units.
bringToFront
Moves the WorldLabel view to the front of the screen view stack.
void bringToFront()
render
Forces immediate rendering of this WorldLabel object.
void render()
setLines
Atomically replaces the label lines. The input must be a dense one-based string array.
void setLines(table lines)
Parameters:
tablelines: Array of text lines.
getText
Returns all lines joined by newline characters.
string getText()
Returns string:
Complete label text.
setText
Replaces all lines by splitting text on newline characters.
void setText(string text)
Parameters:
stringtext: Complete label text.
removeLine
Removes one line by its one-based index.
boolean removeLine(number index)
Parameters:
numberindex: Line index starting at 1.
Returns boolean:
False if out of range.
setLine
Replaces one existing line by its one-based index.
boolean setLine(number index, string text)
Parameters:
numberindex: Line index starting at 1.stringtext: Replacement text.
Returns boolean:
False if out of range.
getLine
Returns one line by its one-based index.
string|nil getLine(number index)
Parameters:
numberindex: Line index starting at 1.
Returns string|nil:
Text or nil if out of range.
Callbacks
No callbacks.