La documentación para este módulo puede ser creada en Módulo:EternalsData/doc

-- <pre>
local p = {}
 
local eternalsData = mw.loadData('Módulo:EternalsData/data')
local lib          = require('Módulo:Feature')
local color        = require('Módulo:Color')
local FN           = require('Módulo:Filename')
--[=[
function p.getType(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return eternalsData[args[1]].type or "Type not specified."
end

function p.getEternal(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return eternalsData[args[1]].eternal or "Eternal not specified."
end

function p.getChampion(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return eternalsData[args[1]].champion or "Champion not specified."
end

function p.getDescription(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return eternalsData[args[1]].description or "Description not specified."
end
--]=]
function p.eternalList(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

    local series = tonumber(args["series"]) or nil
    local champion = args["champion"] or nil
    if series == nil and champion == nil then return end
--    local lang           = mw.language.new( "es" )
    local eternals_table = mw.html.create('table')
    
    local temp = eternals_table
        :addClass('sortable article-table sticky-header')
        :css('width','100%')
        :css('text-align','left')
        :newline()
        :tag('tr')
            :tag('th')
                :wikitext('Campeón')
                :css('white-space','nowrap')
            :done()
            :newline()
    if series == nil and champion ~= nil then 
        temp
            :tag('th')
                :wikitext('Serie')
                :css('white-space','nowrap')
            :done()
            :newline()
    end
        temp
            :tag('th')
                :wikitext('Nombre')
                :css('white-space','nowrap')
            :done()
            :newline()
            :tag('th')
                :wikitext('Tipo')
                :css('white-space','nowrap')
            :done()
            :newline()
            :tag('th')
                :wikitext('Descripción')
                :css('white-space','nowrap')
            :done()
        :done()
    :done()
    :newline()
    
    local empressnode = mw.html.create('span')
    empressnode
        :css('color', 'violet')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "emperatriz")
        :wikitext("EMP")

    local guidenode = mw.html.create('span')
    guidenode
        :css('color', 'green')
        :css('font-weight', '600')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "guía")
        :wikitext("GUI")

    local protectornode = mw.html.create('span')
    protectornode
        :css('color', 'yellow')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "protector")
        :wikitext("PRT")
        
    local tricksternode = mw.html.create('span')
    tricksternode
        :css('color', 'purple')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "bromista")
        :wikitext("BRO")
        
    local wardennode = mw.html.create('span')
    wardennode
        :css('color', 'blue')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "guardián")
        :wikitext("GUA")
        
    local warriornode = mw.html.create('span')
    warriornode
        :css('color', 'red')
        :css('vertical-align', 'text-top')
        :attr('data-sort-value', "guerrero")
        :wikitext("GUE")
    
    local function eternalsrow(eternalchampion, eternalseries, eternalname, eternaltype, eternaldescription, legacy)
        local eternals_row = mw.html.create('tr')
        -- Champion
        if (eternalchampion == "Común") then
            eternals_row
                :tag('td')
                    :attr('data-sort-value', 0)
                    :css('white-space', 'nowrap')
                    :wikitext('Común')
                :done()
        else 
            eternals_row
                :tag('td')
                :addClass('champion-icon')
                :attr('data-sort-value', eternalchampion)
                :attr('data-champion', eternalchampion)
                :attr('data-skin', "Original")
                :css('text-align', 'left')
                :css('white-space', 'nowrap')
                :wikitext('[[Archivo:' .. FN.championcircle({eternalchampion, "Original"}) .. '|26px|link=' .. eternalchampion .. ']] ' .. eternalchampion)
            :done()
        end
        -- Series
        if series == nil and champion ~= nil then 
            eternals_row
                :tag('td')
                    :wikitext(eternalseries)
                :done()
        end
        
        local temp = eternals_row
            :tag('td')
        
        -- Legacy
        if legacy then
            temp
                :wikitext(mw.text.decode('[[Archivo:Legacy skin.png|26px|link=|Legado]]&nbsp;'))
        end
        
        -- Name
        temp
            :addClass('eternal-icon')
            :attr('data-eternal', eternalname)
            :css('text-align', 'left')
            :wikitext(eternalname)
            
        -- Eternal Type
        astring = '<span style="color: cornflowerblue;font-size: large;font-weight: 600;">?</span>'
        if     (eternaltype == "Emperatriz") then
            astring = tostring(empressnode)
        elseif (eternaltype == "Guía") then
            astring = tostring(guidenode)
        elseif (eternaltype == "Protector") then
            astring = tostring(protectornode)
        elseif (eternaltype == "Bromista") then
            astring = tostring(tricksternode)
        elseif (eternaltype == "Guardián") then
            astring = tostring(wardennode)
        elseif (eternaltype == "Guerrero") then
            astring = tostring(warriornode)
        end
        eternals_row
            :tag('td')
                :attr('data-sort-value', eternaltype or "Desprovisto")
                :tag('span')
                    :attr('title', eternaltype or 'Desprovisto')
                    :wikitext(astring)
            :done()
        
        -- Description
        eternals_row
            :tag('td')
                    :wikitext(eternaldescription)
            :done()
        return eternals_row
    end
    
    -- Common Eternals
    if champion == nil then
        local commonEternals = eternalsData['Común']
        if commonEternals ~= nil and commonEternals[series] ~= nil then
            local seriesEternals = commonEternals[series]
            if seriesEternals ~= nil then
                local eternalstable = {}
                for x in pairs(seriesEternals) do
                    table.insert(eternalstable, x)
                end
                table.sort(eternalstable)
                for _, eternalname in pairs(eternalstable) do
                    -- Add row to table
                    eternals_table
                        :newline()
                        :node(eternalsrow('Común', series, eternalname, seriesEternals[eternalname]['eternal'], seriesEternals[eternalname]['description'], seriesEternals[eternalname]['legacy']))
                end
            end
        end
    end
    
    -- Unique Eternals
    local uniqueEternals = eternalsData['Único']
    if uniqueEternals ~= nil then
        local championstable = {}
        if champion == nil then
            for x in pairs(uniqueEternals) do
                table.insert(championstable, x)    
            end
            table.sort(championstable)
        else
            table.insert(championstable, champion)
        end
        for _, eternalchampion in pairs(championstable) do
            local seriestable = {}
            if series == nil then
                for x in pairs(uniqueEternals[eternalchampion]) do
                    table.insert(seriestable, x)
                end
                table.sort(seriestable)
            else
                table.insert(seriestable, series)
            end
            for _, eternalseries in pairs(seriestable) do
                local seriesEternals = uniqueEternals[eternalchampion][eternalseries]
                if seriesEternals ~= nil then
                    local eternalstable = {}
                    for x in pairs(seriesEternals) do
                        table.insert(eternalstable, x)
                    end
                    table.sort(eternalstable)
                    for _, eternalname in pairs(eternalstable) do
                        -- Add row to table
                        eternals_table
                        :newline()
                        :node(eternalsrow(eternalchampion, eternalseries, eternalname, seriesEternals[eternalname]['eternal'], seriesEternals[eternalname]['description'], seriesEternals[eternalname]['legacy']))
                    end
                end
            end
        end
    end
    
    -- END
    eternals_table:allDone()
    return tostring(eternals_table)
end

function p.eternalPage(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    local champion = args['champion'] or nil
    local series = tonumber(args['series']) or nil
    local ret = ''
    
    local function eternalsRows(eternalSeries)
        local rows = ''
        local eternalsTable = {}
        for eternalName in pairs(eternalSeries) do
            table.insert(eternalsTable, eternalName)
        end
        table.sort(eternalsTable)
        for _, eternalName in ipairs(eternalsTable) do
            local eternalType = eternalSeries[eternalName]['eternal']
            local eternalDescription = eternalSeries[eternalName]['description']
            local eternalLegacy = eternalSeries[eternalName]['legacy']
            local eternalRow = mw.html.create('div')
                :cssText('position:relative; display:flex; align-items:center; width:100%; overflow:auto')
            if eternalType == 'Emperatriz' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(196,102,255,0.1), rgba(196,102,255,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            elseif eternalType == 'Guía' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(3,252,119,0.1), rgba(3,252,119,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            elseif eternalType == 'Protector' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(255,251,31,0.1), rgba(255,251,31,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            elseif eternalType == 'Bromista' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(227,3,252,0.1), rgba(227,3,252,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            elseif eternalType == 'Guardián' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(0,200,255,0.1), rgba(0,200,255,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            elseif eternalType == 'Guerrero' then
                eternalRow
                    :cssText('background:linear-gradient(25deg, rgba(255,47,15,0.1), rgba(255,47,15,0.05), rgba(1,10,19,0.3), rgba(1,10,19,0.8), rgb(1, 10, 19));')
            end
            eternalRow
                :tag('div')
                    :css('float', 'left')
                    :css('margin-right', '10px')
                    :wikitext('[[Archivo:The ' .. eternalType .. ' Eternal unique icon.png|frameless|' .. eternalType .. '|link=Eternos#Tipos]]')
                :done()
                :newline()
            if eternalLegacy then
                eternalRow
                    :tag('div')
                        :cssText('position:absolute; top:82px; left:82px;')
                        :wikitext('[[Archivo:Legacy skin.png|40px|Legado|link=Eternos#Tipos]]')
                    :done()
                    :newline()
            end
            eternalRow
                :tag('div')
                    :css('margin-right', '15px')
                    :wikitext('<span class="league-font" style="font-size:18px"><b>' .. eternalName .. '</b></span><br>' .. eternalDescription)
                :done()
                :newline()
            rows = rows .. tostring(eternalRow)
        end
        return rows
    end
    if series then
        local eternalSeries = eternalsData['Único'][champion][series]
        ret = ret .. eternalsRows(eternalSeries)
    else
        local allEternalSeries = eternalsData['Único'][champion]
        local seriesTable = {}
        for series in pairs(allEternalSeries) do
            table.insert(seriesTable, series)
        end
        table.sort(seriesTable, function(a,b) return a > b end)
        ret = ret .. '{{#tag:tabber|'
        for series in ipairs(seriesTable) do
            ret = ret .. 'Serie ' .. series .. '='
            ret = ret .. eternalsRows(allEternalSeries[series])
            ret = ret .. '{{!}}-{{!}}'
        end
        ret = ret .. '}}'
    end
    return frame:preprocess(ret)
end

return p
 
-- </pre>
-- [[Categoría:Lua]]
El contenido de la comunidad está disponible bajo CC-BY-SA a menos que se indique lo contrario.