Module:Infobox/Item

--Get Required Modules local loadLib = require('Module:LoadLib')

loadLib(_G, {	infobox='Infobox',	rarity='RarityTier',	yesno='Yesno' }) local slot = require( Module:Inventory slot ).slot

mw.html.create = require('Module:Html').create local curTitle = mw.title.getCurrentTitle

--Begin Exports local p = {}

function p.infoboxItem(frame) local args = getArgs(frame) local pagename = curTitle.text or "Diamond" local title = args.title or pagename local sections = {} for j = 1,10,1 do		local sectionExists = j==1 or args["tab"..j]		if sectionExists then local i = j==1 and "" or j			sections[#sections+1] = { tab= args["tab"..j] or args["tab"..i], -- purposefully use "j" here since default section does actually use "tab1" image= args["image"..i] or pagename..".png", caption= args["caption"..i] or args["imagecaption"..i], slot_item= yesno(args["slot_item"..i], true) and " "..string.gsub(slot{ args["slot_item"..i] or pagename }, "\n", "").." " or nil, }		end end

-- Make infobox local ibox = infobox.create ibox:addTitle{ title } local panel = ibox:addPanel for i,sdata in ipairs(sections) do       local section = panel:addSection{ label=sdata.tab } section :addImage{ sdata.image, caption={ sdata.caption } } :addData{ sdata.slot_item } end mw.log(ibox) return ibox:preprocess end

--Finish Module/Exports return p