Garry's Mod Wiki

Revision Difference

markup.Parse#520245

<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("&lt;font=Default&gt;changed font&lt;/font&gt;\n&lt;colour=255,0,255,255&gt;changed colour&lt;/colour&gt;") 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) </code> <output><image src="Screenshot-2012-08-30_13.13.59.png"/></output> </example>