markup.Parse

From Garry's Mod
Revision as of 16:24, 11 August 2019 by Robotboy655 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 markup.Parse( )

Contents

Description

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

Arguments

string markup

The markup to be parsed.

Arguments

number maxwidth

The max width of the output

Returns

MarkupObject

The parsed markup object ready to be drawn.

Examples

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:

Screenshot-2012-08-30 13.13.59.png
Personal tools
Navigation