Jump to content

Module:Csdcheck

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius on tour (talk | contribs) at 03:57, 22 March 2013 (check for valid criteria). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.check(frame)
    local result = "Arguments: "
    local crit = {}
    local all = {"G1","G2","G3","G4","G5","G6","G7","G8","G9","G10","G11","G12","A1","A2","A3","A5","A7","A9","A10","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","C1","C2","U1","U2","U3","R2","R3","T2","T3","P1","P2"}
    for k,v in pairs(frame.args) do
        k = tostring(k)
        if mw.ustring.match(k,"^crit[1-9]%d*$") then
            for a,b in ipairs(all) do
                if b == v then
                    table.insert(crit,v)
                end
            end
        end
    end
    for i,v in ipairs(crit) do
        result = result .. v .. ", "
    end
    return result
--[[
local result = nil
    for i,v in ipairs(args) do
        local crit = {"G1","G2","G3","G4"}
        for x,y in ipairs(crit) do
            if v == y then
                result = "yes";
            end
        end
    end
    return result
--]]
end

return p