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:S5EnemyLocationTable/doc

local p = {}

function p.render(frame)
    local args = frame.args

    -- if there’s no location_1, show the default single-line text
    if not args['location_1'] or args['location_1'] == '' then
        return args['location'] or 'Deep Twilight Forest Ruins (Chapter 5)'
    end

    -- build the table
    local tbl = mw.html.create('table')
        :css('width', '100%')
        :css('height', '100%')
        :css('border-collapse', 'collapse')
        :css('table-layout', 'fixed')

    -- header row
    local header = tbl:tag('tr')
    header:tag('th')
        :css('width', '20%')
        :wikitext('Chapter')
    header:tag('th')
        :wikitext('Area')

    -- data rows
    for i = 1, 6 do
        local location = args['location_' .. i]
        if location and location ~= '' then
            local row = tbl:tag('tr')
            row:tag('td'):wikitext(args['ch_' .. i] or '')
            row:tag('td'):wikitext(location)
        end
    end

    return tostring(tbl)
end

return p