Module:SortItems

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 sortedArgs[ord] = bNat ord = ord + 1 break end end end return sortedArgs end

function p.sortBlockers( 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 = 'Blockers', args = sorted } end end

function p.sortFeatures( 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 = 'Other', args = sorted } end end

return p