Link Search Menu Expand Document

Label

A label, used to display text in Alloverse

Constructor

 --Creates a Label, at origo, that is 1m wide, 20cm tall and 1cm deep
 local l = Label{bounds=Bounds(0, 0, 0, 1, 0.2, 0.01)}

 --For convenience, you may also set some or all of the Label's properties within the constructor, i.e.:
 local l = Label{bounds=Bounds(0, 0, 0, 1.0, 0.1, 0.001), color={1.0,0.2,0.4,1}, text="Hello!", halign="left"}

Arguments

Name Type Description
o table A table including at least a Bounds component. It may also include a number of other optional properties: text, lineheight, wrap, halign, color and fitToWidth.

Returns

Nothing


Methods

Label:setText (text)

Sets the Label’s text

Arguments

Name Type Description
text string The text the Label should display

Returns

Nothing


Label:setLineheight (lineheight)

Sets the Label’s line height

Arguments

Name Type Description
lineheight number The Label’s line height (in meters)

Returns

Nothing


Label:setWrap (wrap)

Sets the Label’s horizontal wrap attribute

Arguments

Name Type Description
wrap boolean Whether the Label should line break when reaching the Label’s bounds’ (true) or be allowed to overflow outside the component (false)

Returns

Nothing


Label:setHalign (halign)

Sets the Label’s horizontal align attribute

Arguments

Name Type Description
halign “center”,”top”,”bottom” The alignment of the text within the Labels’ bounds

Returns

Nothing


Label:setColor (color)

Sets the Label’s text color

Arguments

Name Type Description
color {r,g,b,a} The r, g, b and a values of the text color, each defined between 0 and 1.

Returns

Nothing


Label:setFitToWidth (desiredWidth)

Sets the Label’s fitToWidth attribute

Arguments

Name Type Description
desiredWidth number The desired width with which to constrain the label text.

Returns

Nothing