Module:ItemDescription

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

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 = utilsColor.ColorText("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"):addClass("centered"):wikitext(icon .. " " .. item .. "")):done    		:node(mw.html.create("td"):wikitext(description)):done) return result end

return p