Module:Main Page

local p = {} local cargo = mw.ext.cargo local tab2 = require("Module:Tab2") local utilsCode = require("Module:UtilsCode")

function p._DisplayGameList(frame) return p.DisplayGameList end

function p.DisplayGameList local tabCaptions = { {type = "main", caption = "Main Series"}, {type = "remake", caption = "Remakes"}, {type = "spinoff", caption = "Spin-Offs"}, }	-- Get all stored games local tables = "Games" local fields = "name, subtitle, initialism, mainrelease, type" local args = { orderBy = "mainrelease DESC" }	local games = cargo.query(tables, fields, args) -- Generate tabs local maingames = mw.html.create("div") :addClass("game-container main-games") local remakes = mw.html.create("div") :addClass("game-container remakes") local spinoffs = mw.html.create("div") :addClass("game-container spin-offs") local frame = mw.getCurrentFrame for key, game in ipairs(games) do		local releaseYear = "TBA" if not utilsCode.IsEmpty(game["mainrelease"]) then releaseYear = string.sub(game["mainrelease"], 1, 4) end if game["type"] == "main" then maingames:node(mw.html.create("div")				:addClass("game")				:wikitext(" " .. releaseYear .. " " .. frame:expandTemplate{title = game["initialism"]} .. ""))		end end local tabs = {} table.insert(tabs, 1, {tabName = "Main Series", tabCaption = "", tabContent = tostring(maingames)}) table.insert(tabs, 2, {tabName = "Remakes", tabCaption = "", tabContent = tostring(remakes)}) table.insert(tabs, 3, {tabName = "Spin-Offs", tabCaption = "", tabContent = tostring(spinoffs)}) return tab2.Main(tabs, 1, "top", 3, "", "100%", "", "center") end

return p