Garry's Mod Wiki

markup.Parse

MarkupObject markup.Parse( string markup, number maxwidth )

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
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.

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: 28ms

Session 0
DB GetPage 3
Generate Html 5
SaveChanges 8
Render Body 0
Render Sidebar 10