Module:Disassemble

--

local p = {}

function p.main(frame) local args = frame:getParent.args

local components = {}

local level = tonumber(level) or 1

local xp = tonumber(xp) or 1

local _components = mw.text.split(args.components or '','%s*,%s')

for _, v in ipairs(_components) do		local n,l = string.find(v,'(.-) %[(%d+)%]') or v, level table.insert(components,{ n = n, l = l }) end

return p._main(components,level,xp) end

function p._main(comp,lvl,xp) local ret = mw.html.create('div') :wikitext('This item can be disassembled with the Invention skill.')

local _t = ret:tag('table') :addClass('wikitable') :tag('tr') :tag('th') :wikitext('Level') :done :tag('td') :wikitext(lvl) :done :done :tag('tr') :tag('th') :wikitext('Experience') :done :tag('td') :wikitext(xp) :done :done :tag('tr') :tag('th') :attr('colspan','2') :wikitext('Possible components') :done :done

for _, v in ipairs(comp) do		_t:tag('tr') :tag('td') :wikitext(v.n)			:done :tag('td') :wikitext(v.l)			:done :done end

return ret end

return p