Module:ItemDescription

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

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 dimensions = utilsGame.TwoOrThreeDimensions(game) local fileType = "" if dimensions == "2D" then fileType = "Sprite" elseif dimensions == "3D" then fileType = "Icon" end 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("facelift-centered"):wikitext(" " .. item .. "")):done    		:node(mw.html.create("td"):wikitext(description)):done) return result end

return p