Module:Exp Game

local p = {}

local Franchise = require("Module:Franchise") local utilsArg = require("Module:UtilsArg")

local CLASS_NOEXCERPT = require("Module:Constants/class/noexcerpt")

-- Main function called by Template:Exp Game function p.Main(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates["Exp Game"]) local categories = err and err.categoryText or "" local games = args.games if not games or #games == 0 then return "", categories end local gameExp = {} for i, game in ipairs(games) do		local shortName = Franchise.shortName(game) if shortName then local exp = frame:expandTemplate({				title = "Exp",				args = {shortName, game}			}) table.insert(gameExp, ""..exp.."") end end gameExp = table.concat(gameExp, " &#124; ") -- &#124 is the HTML entity for the pipe character. Needs to be entered like this in order to not break tables and such gameExp = string.format('(%s) ', CLASS_NOEXCERPT, gameExp) -- Exp Game looks odd in page preview popups, "noexcerpt" removes it from the previews return gameExp, categories end

p.Templates = { ["Exp Game"] = { purpose = "Indicates for which game(s) a particular statement is true, when that statement is not true for all games.", format = "inline", params = { [1] = {				name = "games", placeholder = "game1, game2, ..., gameN", type = "string", required = true, enum = Franchise.enum({ includeSeries = true }), desc = "A comma-separated list of one or more game codes.", split = true, sortAndRemoveDuplicates = true, }		},		examples = { {"OoT"}, {"Series, OoT, MM"}, {"MM, OoT, MM, OoT"}, {},			{""},			{"fakeGame"}, {"OoT, fakeGame, MM"} }	} }

return p