Module:LimitRoleInput

local p = {} require('Module:StrManip')

function p.main local input = mw.getCurrentFrame.args[1] --local input = "Main (aaaa), Side (asdfasdf)" local out = "" local table = strSplit(input,",\n") mw.logObject(input) local res = "" for i,indOrig in ipairs(table) do       ind = trim(tostring(indOrig):lower:gsub("^%l", string.upper)):gsub(" -%(.*%) -","") if not ind then mw.log("empty") return elseif ind:lower:find("main") then mw.log("Main") role = "Main" elseif ind:lower:find("side") then mw.log("Side") role = "Side" elseif ind:lower:find("minor") then mw.log("Minor") role = "Minor" else mw.log("invalid input") return "Valid values are \"Main\", \"Side\" and \"Minor\".\nSee Help:Guidelines." end if (i > 1) then out = out .. ", "       end out = out .. " " .. indOrig .. " " end

mw.logObject(out) return out end return p