Module:CharSkills

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

function p.main(frame) args = getArgs(frame) if(pcall(p._main, args)) then return p._main(args) else return ' Error. See Template:CharSkills for more info. '   end end function p._main(args) local stars = { ,       ,        ,        ,        '',    }    local n = 5 -- max number of each skill type local rs_wep, rs_sp, rs_spc, rs_A, rs_B, rs_C = 0,0,0,0,0,0 -- rowspans local table = mw.html.create('table') :addClass('wikitable') :cssText('margin: 0; width: 100%') -- Headers local tr = table:tag('tr') tr:tag('th'):wikitext('Type') tr:tag('th'):css('width', '40%'):wikitext('Name') tr:tag('th'):css('width', '30%'):wikitext('Prerequisite') tr:tag('th'):css('width', '15%'):wikitext('Default') tr:tag('th'):css('width', '15%'):wikitext('Unlocked') -- Weapon skills local th = table:tag('tr'):tag('th'):wikitext('') for i = 1, n do       if (args['weapon '..i] ~= nil) then local cols = mw.text.split(args['weapon '..i], '*') rs_wep = i           table:tag('tr') :tag('td'):wikitext(cols[1]) :tag('td'):wikitext(cols[2]) :tag('td'):wikitext(cols[3]) :tag('td'):wikitext(cols[4]) else break end end th:attr('rowspan', rs_wep + 1) return tostring(table) end