Module:Infobox/Block

local p = {}

local g = require("Module:Common") local box = require("Module:Infobox") local invItem = require("Module:Infobox/InvItem")

-- returns MW code for a block (NOT item) infobox function p.main(frame) local frame, args = g.getFrameAndArgs(frame) if not g.isGiven(args.type) then args.type = "Block" end local l = "" l = l .. box.condRow("Solid", args.solid, "Yes") l = l .. box.condRow("Transparent", args.trans, "No") l = l .. box.condRow("Affected by Gravity", args.gravity, "No") if g.isGiven(args.light) then local nlight = tonumber(args.light) if nlight == nil then l = l .. box.row("Emits Light", args.light) elseif nlight <= 0 then l = l .. box.row("Emits Light", "No") else l = l .. box.row("Emits Light", "Yes (" .. tostring(nlight) .. ")")		end else l = l .. box.row("Emits Light", "No") end l = l .. box.condRow("Flammable", args.flammable, "No") if g.isGiven(args.drops) then l = l .. box.row("Drops", args.drops) end if g.isGiven(args.tool) then local tools = {} for tool in string.gmatch(args.tool, "[^;]+") do			table.insert(tools, frame:expandTemplate{title="ToolImage", args={tool}}) end l = l .. box.row("Required Tool", table.concat(tools, " ")) else l = l .. box.row("Required Tool", "Unknown") end -- Need to clear these args so that Infobox/InvItem doesn't handle them again args.trans, args.gravity, args.light, args.tool, args.tool2 = nil, nil, nil, nil, nil if g.isGiven(args.rows) then l = l .. args.rows end args.rows = l	frame.args = args return invItem.main(frame) end

return p