Module:Pronouns: Difference between revisions

From Pixlies
Content deleted Content added
testing
testing
Tag: Reverted
Line 21: Line 21:


if #selectedPronouns == 0 then
if #selectedPronouns == 0 then
elseif #selectedPronouns == 1 then
local pronouns = {
he = "he/him",
she = "she/her",
they = "they/them"
}
return table.concat(selectedPronouns) .. table.concat(categories)
else
else
return table.concat(selectedPronouns, "/") .. table.concat(categories)
return table.concat(selectedPronouns, "/") .. table.concat(categories)

Revision as of 01:32, 28 July 2023

Documentation for this module may be created at Module:Pronouns/doc

local p = {}

function p.pronoun(frame)
    local args = frame.args

    local pronouns = {
        he = "he",
        she = "she",
        they = "they"
    }

    local selectedPronouns = {}
    local categories = {}

    for i, arg in ipairs(args) do
        if pronouns[arg] then
            table.insert(selectedPronouns, pronouns[arg])
            table.insert(categories, "[[Category:Players who are a " .. pronouns[arg] .. "]]")
        end
    end

    if #selectedPronouns == 0 then
    elseif #selectedPronouns == 1 then
		local pronouns = {
        	he = "he/him",
        	she = "she/her",
        	they = "they/them"
    	}
    	return table.concat(selectedPronouns) .. table.concat(categories)
    else
        return table.concat(selectedPronouns, "/") .. table.concat(categories)
    end
end

return p