模块:CallPFAtk

来自希服维基

可在模块:CallPFAtk/doc创建此模块的帮助文档

local p = {}
function p.test(frame)
    local parent = frame:getParent()
    if not parent or not parent.callParserFunction then return "no_callPF" end

    local results = {}

    -- Try different function names
    local funcs = {
        "expr", "#expr", "if", "#if", "ifexpr", "#ifexpr",
        "ifeq", "ifexist", "switch", "time", "urlencode",
        "lc", "uc", "lcfirst", "ucfirst", "formatnum",
        "padleft", "padright", "anchorencode", "ns",
        "int", "syntaxhighlight", "tag",
    }

    for _, func_name in ipairs(funcs) do
        local ok, out = pcall(parent.callParserFunction, parent, func_name, "1+1")
        local status = tostring(ok)
        if ok then
            status = status .. ":" .. tostring(out):sub(1,40)
        else
            status = status .. ":" .. tostring(out):sub(1,60)
        end
        results[#results+1] = func_name .. "=" .. status
    end

    return table.concat(results, " | ")
end
return p