Fix Vip List sorting
Fixes Vip list sorting issues for both alphabetical sorting and online/offline sorting. Fixes Issue #169 Tested in 8.61
This commit is contained in:
parent
3ed2eeb104
commit
4c0c6e635e
|
@ -97,13 +97,14 @@ function onAddVip(id, name, state)
|
||||||
|
|
||||||
for i=1,childrenCount do
|
for i=1,childrenCount do
|
||||||
local child = vipList:getChildByIndex(i)
|
local child = vipList:getChildByIndex(i)
|
||||||
if state == VipState.Online and not child.vipState == VipState.Online then
|
if state == VipState.Online and child.vipState ~= VipState.Online then
|
||||||
vipList:insertChild(i, label)
|
vipList:insertChild(i, label)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (not state == VipState.Online and not child.vipState == VipState.Online)
|
if (state ~= VipState.Online and child.vipState ~= VipState.Online)
|
||||||
or (state == VipState.Online and child.vipState == VipState.Online) then
|
or (state == VipState.Online and child.vipState == VipState.Online) then
|
||||||
|
|
||||||
local childText = child:getText():lower()
|
local childText = child:getText():lower()
|
||||||
local length = math.min(childText:len(), nameLower:len())
|
local length = math.min(childText:len(), nameLower:len())
|
||||||
|
|
||||||
|
@ -113,6 +114,8 @@ function onAddVip(id, name, state)
|
||||||
return
|
return
|
||||||
elseif nameLower:byte(j) > childText:byte(j) then
|
elseif nameLower:byte(j) > childText:byte(j) then
|
||||||
break
|
break
|
||||||
|
elseif j == nameLower:len() then -- We are at the end of nameLower, and its shorter than childText, thus insert before
|
||||||
|
vipList:insertChild(i, label)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue