Simplify code of mainmenu world sort

This commit is contained in:
Novatux 2013-08-05 18:49:19 +02:00 committed by PilzAdam
parent 7fbc8152bf
commit 779165144e

@ -240,17 +240,9 @@ end
function sort_worlds_alphabetic(this)
table.sort(this.m_processed_list, function(a, b)
local n1 = a.name
local n2 = b.name
local count = math.min(#n1, #n2)
for i=1,count do
if n1:sub(i, i):lower() < n2:sub(i, i):lower() then
return true
elseif n1:sub(i, i):lower() > n2:sub(i, i):lower() then
return false
if a.name:lower() == b.name:lower() then
return a.name < b.name
end
end
return (#n1 <= #n2)
return a.name:lower() < b.name:lower()
end)
end