Garry's Mod Wiki

Revision Difference

markup.Parse#518623

<function name="Parse" parent="markup" type="libraryfunc"> <description>Parses markup into a <page>MarkupObject</page>. Currently, this only supports fonts and colors as demonstrated in the example.</description> <realm>Client</realm> <args> <arg name="markup" type="string">The markup to be parsed.</arg> <arg name="maxwidth" type="number">The max width of the output</arg> </args> <rets> <ret name="" type="MarkupObject">The parsed markup object ready to be drawn.</ret> </rets> </function> <example> <description>Renders a markup string on the HUD.</description> <code> local parsed = markup.Parse("&amp;lt;font=Default&amp;gt;changed font&amp;lt;/font&amp;gt;\n&amp;lt;colour=255,0,255,255&amp;gt;changed colour&amp;lt;/colour&amp;gt;") local parsed = markup.Parse("&lt;font=Default&gt;changed font&lt;/font&gt;\n&lt;colour=255,0,255,255&gt;changed colour&lt;/colour&gt;") hook.Add("HUDPaint", "MarkupTest", function() parsed:Draw(100, 100, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end) </code> <output><image src="Screenshot-2012-08-30_13.13.59.png"/></output> </example>