Module:Role

local p = {}

function p.role( frame ) local args = frame if frame == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else frame = mw.getCurrentFrame end -- load data / functions local Names = mw.loadData('Module:Rolenames') local Styles = require('Module:Rolestyles') -- get args local input = args[1] or '' local inputlc = mw.ustring.lower(args[1] or '') local style = args[2] or 'default' local issub = string.lower(args['sub'] or 'no') -- Available Settings: -- * sub -- * sorted -- * allowdefault -- variables local subvars = {} -- variables based on whether it's a sub or not local namevars = {} -- If a player is ONLY a substitute, everything is treated totally different because then the full word "Substitute" is written out, and it has its own icon instead of S over another role icon etc.	if issub == "yes" and inputlc == "" then inputlc = "substitute" issub = "no" end if issub == "yes" then subvars = { s = 'S ', sortnumber = 20, text = "Sub/", div = ' ', div2 = ' ', display = 'short' }	else subvars = { s = "", sortnumber = 10, text = "", div = "", div2 = "", display = 'role' }	end -- now cleanrole is just the role, nothing with substitute or anything local namevars = Names[inputlc] if not namevars then if args["allowdefault"] == "yes" then namevars = { adjective = input, short = input, role = input, rolelc = inputlc, sentence = input .. " for", article = "a", sortnumber = 70 } else namevars = {adjective = "Unrecognized Role", short = "???", role = "Player", rolelc = "player", sentence = "player for", article = "a" } end elseif type(namevars) == 'string' then namevars = Names[namevars] end local text = Styles[style](namevars, subvars, args) return text end return p