Garry's Mod Wiki

Revision Difference

markup.Parse#511566

<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;")⤶ ⤶ hook.Add("HUDPaint", "MarkupTest", function()⤶ parsed:Draw(100, 100, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)⤶ end)⤶ </code>⤶ <output></output>⤶ ⤶ </example>