Skip to content

Commit

Permalink
Simplify code of mainmenu world sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs authored and PilzAdam committed Aug 6, 2013
1 parent 7fbc815 commit 7791651
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions builtin/filterlist.lua
Expand Up @@ -239,18 +239,10 @@ 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
end
end
return (#n1 <= #n2)
end)
table.sort(this.m_processed_list, function(a, b)
if a.name:lower() == b.name:lower() then
return a.name < b.name
end
return a.name:lower() < b.name:lower()
end)
end

0 comments on commit 7791651

Please sign in to comment.