Module:WeaponNav
From Incursion Red River Wiki
More actions
local p = {}
local categories = {
{ param = "pistol", label = "Pistols", path = "/Pistols" },
{ param = "smg", label = "SMGs", path = "/SMGs" },
{ param = "shotgun", label = "Shotguns", path = "/Shotguns" },
{ param = "assault_rifle", label = "Assault Rifles", path = "/Assault_Rifles" },
{ param = "dmr", label = "DMRs", path = "/DMRs" },
{ param = "sniper_rifle", label = "Sniper Rifles", path = "/Sniper_Rifles" },
{ param = "lmg", label = "LMGs", path = "/LMGs" },
{ param = "melee", label = "Melee", path = "/Melee" },
}
function p.main(frame)
local args = frame:getParent().args local title = mw.title.getCurrentTitle().text
local nav = mw.html.create("table")
:addClass("wikitable")
:css("width", "100%")
:css("white-space", "nowrap")
:css("border-collapse", "collapse")
:css("line-height", "1.0")
local row = nav:tag("tr")
row:tag("th")
:wikitext("Overview")
for _, category in ipairs(categories) do
local value = args[category.param]
if value and value ~= "" then
row:tag("td")
:wikitext(
"[[" .. title .. category.path ..
"|" .. "" .. category.label .. "" .. "]]"
)
end
end
return tostring(nav)
end
return p