24,537 ARTICLES
ON THIS WIKI

Module:Infobox/Mod

< Module:Infobox

Name Parameter
Name Parameter
Your Ad Caption Here
Name Name Parameter
Creator Myself
Type Utility
Latest Version 1.3.3.7
Minecraft Version Beta 1.6
Website Official Site
Forum Totally Our Forums
Config File awesomemod.cfg
Root Mod Stand Alone
Custom Row working
Lua Logo.svg This is the Lua module for Template:Infobox/Mod. Below is the documentation for that template.

Parameters[edit]

  • name: Mod name and infobox title. Should only be used if actual name differs from page title. Default: {{PAGENAME}}.
  • img: Modpack image (without File: or square brackets). Replaces {{{image}}}.
  • imgwidth: Width of the image. Ignored if {{{image}}} is used. Default: 250px.
  • caption: Caption that appears under the image. May also be displayed if no image is present. Default: Hidden.
  • dev: Developer/s of the mod. Default: Unknown.
  • type: The type of the mod. Default: Hidden.
  • version: Latest available version of the mod. Default: Unknown.
  • mcversion: Version of Minecraft required by the latest version of the mod. Default: Unknown.
  • url: Mod website or download link. Default: Hidden.
  • forum: Mod forum or forum post. Default: Hidden.
  • cfg: Name of the mod's config file, if any. Default: Hidden.
  • addon: Deprecated. Any mods that are based on and extend this mod. Default: Dynamic list generated by SMW.
  • root: All mods required for this mod or none for Stand Alone. Default: Unspecified.
  • rows: Additional info rows besides Name. Consists of multiple {{Infobox/Row}}s, separated by single line breaks. Default: Hidden.

local p = {}

local g = require("Module:Common")
local box = require("Module:Infobox")
local modnames = require("Module:ModNames")

function p.main(frame)
	local frame, args = g.getFrameAndArgs(frame)
	local l = ""
	
	if not g.isGiven(args.imgwidth) then
		args.imgwidth = "250px"
	end
	
	if g.isGiven(args.dev) then
		local devstr = ""
		for dev in string.gmatch(args.dev, "[^,;]+") do
			devstr = devstr .. "[[Created by::" .. dev .. "]], "
		end
		l = l .. box.row("Creator", string.sub(devstr, 1, -3))
	else
		l = l .. box.row("Creator", "Unknown")
	end
	l = l .. box.condRow("Type", args.type)
	if g.isGiven(args.version) then
		l = l .. box.row("Latest Version", "<span class=\"modversion\">[[Version::" .. args.version .. "]]</span>")
	else
		l = l .. box.row("Latest Version", "<span class=\"modversion\">Unknown</span>")
	end
	if g.isGiven(args.snapshot) then
		l = l .. box.condRow("Latest Snapshot", '[https://minecraft.gamepedia.com/' .. args.snapshot .. ' ' .. args.snapshot .. ']')
	end
	if g.isGiven(args.mcversion) then
		l = l .. box.row("[[Minecraft]] Version", "[[Minecraft version::" .. args.mcversion .. "]]")
	else
		l = l .. box.row("[[Minecraft]] Version", "Unknown")
	end
	l = l .. box.condRow("Website", args.url)
	l = l .. box.condRow("Forum", args.forum)
	if g.isGiven(args.curseforge) then
		l = l .. box.condRow("Curseforge", '[https://minecraft.curseforge.com/projects/' .. args.curseforge .. ' Project site]')
	end
	l = l .. box.condRow("Patreon", args.patreon)
	l = l .. box.condRow("Config File", args.cfg)
	
	l = l .. box.condRow("Add-on Mods", frame:callParserFunction{name="#ask", args={
		"[[Category:Mods]] [[Has root mod::" .. mw.title.getCurrentTitle().fullText .. "]]",
		limit="15",
		format="list",
		sep="<br/>",
		searchlabel="<br/>...more",
	}})
	
	if g.isGiven(args.root) then
		if args.root == "none" then
			l = l .. box.row("Root Mod", "Stand Alone")
		else
			local rootstr = ""
			for mod in string.gmatch(args.root, "[^,;]+") do
				rootstr = rootstr .. modnames.getWikilink(mod, "Has root mod") .. ", "
			end
			l = l .. box.row("Root Mod", string.sub(rootstr, 1, -3))
		end
	else
		l = l .. box.row("Root Mod", "Unspecified")
	end
	
	l = l .. box.condRow("Modpacks", frame:callParserFunction{name="#ask", args={
		("[[Category:Modpacks]] [[Has mod::".. mw.title.getCurrentTitle().fullText .. "]]" ..
		"OR [[Category:Modpacks]] [[Has optional mod::" .. mw.title.getCurrentTitle().fullText .. "]]"),
		limit="15",
		format="list",
		sep="<br/>",
		searchlabel="<br/>...more",
	}})
	
	if g.isGiven(args.rows) then
		l = l .. args.rows
	end
	
	args.rows = l
	frame.args = args
	
	return box.main(frame)
end

return p