Vital.sandbox
SVG

self:update

Client

Updates the SVG instance contents from a raw SVG string


Syntax

local status = self:update(raw)

Parameters

TypeNameDescription
stringrawRaw SVG markup string to replace the current contents with

Returns

TypeNameDescription
boolstatustrue on successful execution, or false on failure

Examples

Update an SVG instance with new markup
local icon = svg.create_from_raw([[
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
        <circle cx="50" cy="50" r="50"/>
    </svg>
]])

icon:update([[
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
        <rect width="100" height="100"/>
    </svg>
]])

On this page