ax.util¶
Source: gamemode/framework/util/util_text.lua
Utility helpers used across the Parallax framework (printing, file handling, text utilities, etc.).
Section: text_utilities
Documented functions: 6
Functions¶
ax.util:CapText(text, maxLength)ax.util:CapTextWord(text, maxLength)ax.util:GetTextHeight(font)ax.util:GetTextSize(font, text)ax.util:GetTextWidth(font, text)ax.util:GetWrappedText(text, font, maxWidth)
ax.util:CapText(text, maxLength)¶
Utility helpers used across the Parallax framework (printing, file handling, text utilities, etc.). Text utilities. Cap text to a maximum number of characters, adding ellipsis when trimmed.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Text to cap |
maxLength |
number |
Maximum number of characters |
Returns
string: The truncated text (with ellipsis when trimmed)
Usage
ax.util:CapTextWord(text, maxLength)¶
Cap text at a word boundary to avoid breaking words when truncating.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Text to cap |
maxLength |
number |
Maximum number of characters |
Returns
string: The truncated text at a word boundary
Usage
ax.util:GetTextHeight(font)¶
Returns the given text's height (client-only).
Parameters
| Name | Type | Description |
|---|---|---|
font |
string |
Font name |
Returns
number: Height in pixels
Usage
ax.util:GetTextSize(font, text)¶
Returns the given text's size (client-only).
Parameters
| Name | Type | Description |
|---|---|---|
font |
string |
Font name |
text |
string |
Text to measure |
Returns
number: w, number h Width and height in pixels
Usage
ax.util:GetTextWidth(font, text)¶
Returns the given text's width (client-only).
Parameters
| Name | Type | Description |
|---|---|---|
font |
string |
Font name |
text |
string |
Text to measure |
Returns
number: Width in pixels
Usage
ax.util:GetWrappedText(text, font, maxWidth)¶
Wraps text into multiple lines based on a maximum width (client-only).
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Text to wrap |
font |
string |
Font name used to measure text |
maxWidth |
number |
Maximum width in pixels |
Returns
table: An array of line strings
Usage