Module:ProfessionList: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 109: Line 109:
end
end
end
end
-- sort the output by the .level parameter
table.sort(output, function(item1, item2)
-- if one of the two has no leve
if (item1.level == nil) ~= (item2.level == nil) then
-- true if lvl2 is nil but not lvl1, false if lvl1 is nil but not lvl2
return item2.level == nil
end
if item1.level == nil then
-- if both are empty, treat as equivalent
return false
end
-- normal comparison
return item1.level < item2.level
end)
return output
return output