Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:S2TechniqueTable/doc

local p = {}

function p.render(frame)
    -- Create outer table
    local tbl = mw.html.create('table')
        :addClass('table')
        :css('border', '1px solid #0077c0')
        
    -- Add identifying class for CSS
    tbl:addClass('attacktable-responsive')
    
    -- Header row
    local headerRow = tbl:tag('tr')
    local headers = {
        { text = 'Name',    width = '15%', border = 'border-top-left-radius:0;' },
        { text = 'Type',    width = '10%' },
        { text = 'Element', width = '15%' },
        { text = 'Range',   width = '10%' },
        { text = 'Target',  width = '15%' },
        { text = 'Effect',  width = '30%', border = 'border-top-right-radius:0;' }
    }

    for _, h in ipairs(headers) do
        headerRow:tag('th')
            :addClass('header')
            :cssText(h.border or '')
            :css('width', h.width)
            :css('text-align', 'center')
            :wikitext(h.text)
            :done()
    end

    -- Collect rows
    for i = 1, 4 do
        local type = frame.args['type_' .. i]
        if type and type ~= '' then
            local r = tbl:tag('tr')
            r:tag('td'):wikitext(attack or 'Attack ' .. i)
            r:tag('td'):wikitext(frame.args['type_' .. i] or 'Physical')
            r:tag('td'):wikitext(frame.args['element_' .. i] or '—')
            r:tag('td'):wikitext(frame.args['range_' .. i] or 'M')
            r:tag('td'):wikitext(frame.args['target_' .. i] or 'Single')
            r:tag('td'):wikitext(frame.args['effect_' .. i] or '—')
        end
    end

    return tostring(tbl)
end

return p