FANDOM


local p = {}
 
local function _sortItems( nativeArgs, orderedList )
    local sortedArgs = {}
    local ord = 1
 
    for iOrd, bOrd in ipairs(orderedList) do
        for iNat, bNat in ipairs(nativeArgs) do
            if bOrd == bNat then
                -- add match to ordered list
                sortedArgs[ord] = bNat
                ord = ord + 1
                break
            end
        end
        if (not nativeArgs[ord] or nativeArgs[ord] =='' ) then
            break -- found all arguments
        end
    end
    return sortedArgs
end
 
function p.displayBlockers( frame )
    a = frame.args
    if (not a[1]) or (a[1] == '') then
        return ''
    else
        local sorted = _sortItems(a, mw.loadData('Module:OrderedListBlockers'))
        return  frame:expandTemplate{ title = 'ShowBlockers', args = sorted }
    end
end
 
function p.displayOtherFeatures( frame )
    a = frame.args
    if (not a[1]) or (a[1] == '') then
        return ''
    else
        local sorted = _sortItems(a, mw.loadData('Module:OrderedListFeatures'))
        return  frame:expandTemplate{ title = 'ShowOtherFeatures', args = sorted }
    end
end
 
function p.displayCharacters( frame )
    a = frame.args
    if (not a[1]) or (a[1] == '') then
        return ''
    else
        local sorted = _sortItems(a, mw.loadData('Module:OrderedListCharacters'))
        return  frame:expandTemplate{ title = 'ShowCharacters', args = sorted }
    end
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.