Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 18:50, 8 April 2026 by Azera (talk | contribs) (Create module for automatically rendering a slot info table. Accepts variable number of arguments consisting of name;slotType;index where index is optional)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local rows = {}

    for i, v in ipairs(args) do
        local parts     = mw.text.split(v, ';')
        local name      = mw.text.trim(parts[1] or '')
        local slotType  = mw.text.trim(parts[2] or 'None')
        local index     = parts[3] and mw.text.trim(parts[3]) or tostring(i - 1)
        if name ~= '' then
            table.insert(rows, '|-\n| ' .. name .. ' || ' .. slotType .. ' || ' .. index)
        end
    end

    return '{| class="wikitable"\n|-\n! Slot Name !! Type !! Index\n'
        .. table.concat(rows, '\n') .. '\n|}'
end

return p