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 -- 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