Simplify code of mainmenu world sort
parent
7fbc8152bf
commit
779165144e
|
@ -239,18 +239,10 @@ end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function sort_worlds_alphabetic(this)
|
function sort_worlds_alphabetic(this)
|
||||||
|
|
||||||
table.sort(this.m_processed_list, function(a, b)
|
table.sort(this.m_processed_list, function(a, b)
|
||||||
local n1 = a.name
|
if a.name:lower() == b.name:lower() then
|
||||||
local n2 = b.name
|
return a.name < b.name
|
||||||
local count = math.min(#n1, #n2)
|
end
|
||||||
|
return a.name:lower() < b.name:lower()
|
||||||
for i=1,count do
|
end)
|
||||||
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)
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue