Skip to content

Commit 7791651

Browse files
EkdohibsPilzAdam
authored andcommittedAug 6, 2013
Simplify code of mainmenu world sort
1 parent 7fbc815 commit 7791651

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed
 

‎builtin/filterlist.lua

+6-14
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,10 @@ end
239239
--------------------------------------------------------------------------------
240240
function sort_worlds_alphabetic(this)
241241

242-
table.sort(this.m_processed_list, function(a, b)
243-
local n1 = a.name
244-
local n2 = b.name
245-
local count = math.min(#n1, #n2)
246-
247-
for i=1,count do
248-
if n1:sub(i, i):lower() < n2:sub(i, i):lower() then
249-
return true
250-
elseif n1:sub(i, i):lower() > n2:sub(i, i):lower() then
251-
return false
252-
end
253-
end
254-
return (#n1 <= #n2)
255-
end)
242+
table.sort(this.m_processed_list, function(a, b)
243+
if a.name:lower() == b.name:lower() then
244+
return a.name < b.name
245+
end
246+
return a.name:lower() < b.name:lower()
247+
end)
256248
end

0 commit comments

Comments
 (0)
Please sign in to comment.