FANDOM


--
-- Alters args to behave a bit more like how they do in parser functions
--
-- > Empty strings become nil
-- > Yes and No arguments become true and false (booleans) respectively
--
 
local p = {}
 
function p.alter ( args )
 
    local _args = {}
 
    -- for mapping certain arguments to predefined values
    local switch = {
        -- map yes/no to booleans
        ['yes'] = true,
        ['no'] = false
    }
 
    for k, v in pairs( args ) do
        -- exclude empty strings
        if v ~= '' then
            if switch[mw.ustring.lower( v )] then
                _args[k] = switch[mw.ustring.lower( v )]
            else
                _args[k] = v
            end
        end
    end
 
    return _args
 
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.