Garry's Mod Wiki

markup.Parse

MarkupObject markup.Parse( string markup, number maxWidth = nil )

Description

Parses markup into a MarkupObject. Currently, this only supports fonts and colors as demonstrated in the example.

Arguments

1 string markup
The markup to be parsed.
2 number maxWidth = nil
The max width of the output

Returns

1 MarkupObject
The parsed markup object ready to be drawn.

Example

Renders a markup string on the HUD.

The the <colour> tag can also be written as <color>, and the <font> tag can also be written as <face>
local parsed = markup.Parse("<font=Default>changed font</font>\n<colour=255,0,255,255>changed colour</colour>") hook.Add("HUDPaint", "MarkupTest", function() parsed:Draw(100, 100, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end)
Output:

Page Links


Special Pages


Wikis

?

Render Time: 84ms

DB GetPage 42
Generate Html 9
SaveChanges (1) 19
Render Body 0
Render Sidebar 12