Template:Sandbox invoke/doc

From Wikisource
Jump to navigation Jump to search

Usage[edit]

Simple wrapper around Module:Sandbox that calls the sandbox function.

This is useful from other sandboxes, where you can call this template with whatever parameters you want:

{{sandbox invoke
 | foo = bar 
}}

From the sandbox function of Module:Sandbox, you can access the arguments as normal:

function p.sandbox(frame)
    local args = frame:getParent().args

    -- this will print "foo: bar"
    return "foo: " .. args['foo'] 
end

You can then use the sandbox that calls this template in the "Preview page with this template" field while debugging Module:Sandbox.

You can set the called function with _function. Default is sandbox.

See also[edit]