Module:ItemDescription

-- This modules serves as the code for Template:Item Description local cargo = mw.ext.cargo local Color = require("Module:Color") local File = require("Module:File")

local p = {}

function p._DisplayDescriptionTable(frame) local args = frame.args return p.DisplayDescriptionTable(args["game"], args["item"]) end

function p.DisplayDescriptionTable(game, item) local result = "" local tables = "ItemDescriptions" local fields = "game, description" local args = { where = "game = '" .. game .. "' AND name = '" .. item .. "'",       limit = 1 }   local fetchedItem = cargo.query(tables, fields, args)[1] local icon = File.icon(game, item, {   	size = "64x64px"    }) local description if game == "CoH" then description = Color.color("CoH Yellow", item) .. " " .. fetchedItem["description"] end result = mw.html.create("table"):addClass("wikitable") :node(mw.html.create("tr")   		:node(mw.html.create("th"):wikitext("Item")):done    		:node(mw.html.create("th"):wikitext("Description")):done):done :node(mw.html.create("tr")   		:node(mw.html.create("td"):css("text-align", "center"):wikitext(icon .. " " .. item .. "")):done    		:node(mw.html.create("td"):wikitext(description)):done) return result end

return p