Difference between revisions of "Module:SandboxFrames"

From Rhizome Catalog
Jump to: navigation, search
(Created page with "local p = {} local function tableToString(t) local key local value local result result = '' for key, value in pairs(t) do if (tonumber(key) ~=...")
(No difference)

Revision as of 14:51, 25 April 2016

args
table[1] is These
table[2] is are
table['arg3'] is frame args.
callParserFunction
2019-10-20 06:54:46
expandTemplate
arg1 arg2
extensionTag
[[text]]
getParent
Module:SandboxFrames/doc
getTitle
Module:SandboxFrames

local p = {}

local function tableToString(t)
    local key
    local value
    local result
 
    result = ''
 
    for key, value in pairs(t) do
        if (tonumber(key) ~= nil) then
            result = result .. ':table[' .. key .. '] is ' .. value .. '\n' 
        else
            result = result .. ':table[\'' .. key .. '\'] is ' .. value .. '\n' 
        end
    end
 
    return result
end
 
function p.args(frame)
    return ';args\n' .. tableToString(frame.args)
end

function p.callParserFunction(frame)
    return ';callParserFunction\n:' .. frame:callParserFunction('#time', 'Y-m-d H:i:s') .. '\n'
end

function p.expandTemplate(frame)
    return ';expandTemplate\n:' .. frame:expandTemplate({title = 'Template:Sandbox', args = {'arg1', 'arg2'}}) .. '\n'
end

function p.extensionTag(frame)
    return ';extensionTag\n:' .. frame:extensionTag('nowiki', '[[text]]', {}) .. '\n'
end

function p.getParent(frame)
	frame = frame:getParent()
    return ';getParent\n:' .. frame:getTitle() .. '\n'
end

function p.getTitle(frame)
    return ';getTitle\n:' .. frame:getTitle() .. '\n'
end

return p