Module:ContentOf

local p = {}

function p.ReturnListofGames(frame) local GamesList = { -- Example Entry       ["Game Name"] = {            ["Image"] = "File:GameIcon.(extension)" / replace (extension) with something like .PNG or .webp            ["Accepted"] = {"Game Name","GN", and so on...} / This defines parameters. i.e. DG --> Dream Game, FatC - Forge and the Crucible        }        -- ["Dream Game"] = { ["Image"] = "DGLogo2.png", ["Accepted"] = {"dream game", "dg", "frozen soul"} },       ["The Forge and the Crucible"] = { ["Image"] = "ForgeLogo2.png", ["Accepted"] = {"forge", "the forge and the crucible", "forge and the crucible", "tfatc"} },       ["Ghostright"] = { ["Image"] = "GRLogo2.png", ["Accepted"] = {"ghostright", "gr"} },       ["Roulette Saloon"] = { ["Image"] = "RouletteLogo2.png", ["Accepted"] = {"roulette saloon", "roulette", "saloon", "rs"} },       ["Wizard Warz"] = { ["Image"] = "WWLogo2.png", ["Accepted"] = {"wizard warz", "wizard wars", "ww"} },       ["Viper Enclave"] = { ["Image"] = "ViperLogo3.png", ["Accepted"] = {"viper enclave", "viper", "ve"} },       ["Nevermoor's Murder Mystery"] = { ["Image"] = "NevermoorIcon2.png", ["Accepted"] = {"nevermoor", "nevermoor's", "nevermoor murder mystery", "nevermoor's murder mystery", "nevermoor's murder", "murder", "murder mystery", "nmm"} },       ["Minigame World: Reborn"] = { ["Image"] = "MWLogo2.png", ["Accepted"] = {"minigame world reborn", "minigame world: reborn", "minigames world reborn", "minigames world: reborn", "minigame world", "minigames world", "minigame", "minigames", "mgwr", "mwr", "mg"} },       ["Thieves in the House"] = { ["Image"] = "TITHLogo2.png", ["Accepted"] = {"thieves in the house", "thieves", "tith"} },       ["Humanoid Harvester Horror"] = { ["Image"] = "HHHLogo2.png", ["Accepted"] = {"humanoid harvester horror", "humanoid harvestor horror", "hhh", "cheeseburger apocalypse"} },       ["Epic Department"] = { ["Image"] = "Epic1.webp", ["Accepted"] = {"epic department", "epic", "ed"} }   }    local PassedGames = frame.args["Games"] -- Not inside a table yet, that is for PassedTable local PassedTable = {} local ReturnedResult = ""

local function IfContains(table,comparedto) -- Checks a table to see if comparedto is present inside for _,value in pairs(table) do           if value == comparedto then return true end end return false end

local function Format(Game) return " " .. Game .. " " end

if PassedGames == "" then error("No parameter passed to module?") end

if string.lower(PassedGames) == "all" then for Game, _ in pairs(GamesList) do if Game ~= "Epic Department" then -- Exception from the "All" parameter. ReturnedResult = ReturnedResult .. "  "            end end ReturnedResult = ReturnedResult .. " This page contains content for all Dreamsphere-related games." return ReturnedResult end

for Game in PassedGames:gmatch("[^%s,][^,]+") do -- Populate PassedGames with parameter table.insert(PassedTable,Game:lower) end for Game,_ in pairs(GamesList) do       for _,AcceptedName in ipairs(GamesList[Game]["Accepted"]) do            if IfContains(PassedTable,AcceptedName) == true then ReturnedResult = ReturnedResult .. Format(Game) .. " and " end end end return ("This page contains content for " .. ReturnedResult:sub(1,(string.len(ReturnedResult)-5)) .. ".") -- The weird string.sub is just me not knowing how to remove the last "/"... end return p