Module:DunItem

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args) local IS = require("Module:IS").main local item = IS({args[1]}) or "nil" local name = args[1] or '??' local loc = args[2] or '??' local tile = args[3] or '??' local visibility = args[4] or '??' local sprite = args["sprite"] or nil local color = args["color"] or nil local row = mw.html.create local cells = mw.html.create if sprite then item = IS({sprite}) end cells :tag('td'):wikitext(item) :done :tag('td'):wikitext(name) :done :tag('td'):wikitext(loc) :done :tag('td'):wikitext(tile) :done :tag('td'):wikitext(visibility) :done

if color then row :tag('tr'):css( 'background-color', '#'..mw.getCurrentFrame:expandTemplate { title = 'TableColor', args = { 'row', color } } ) :node(cells) else row :tag('tr'):css( 'background-color', '#'..mw.getCurrentFrame:expandTemplate { title = 'TableColor', args = { 'row' } } ) :node(cells) end

return tostring(row) end

return p

-- print(p.main)