Closed zsmhunter closed 4 years ago
thank you.
please try:
table.sort(
sortedK,
function( l, r )
local lt = type( l )
local rt = type( r )
if lt ~= rt then
return lt < rt
else
return l < r
end
end
)
个人不建议这么sort。这样lua的排序会出现乱序问题,会报错的,我现在的做法是判断到有类型不同,直接换了个sortfunction
如果key值同时有number跟string的话,sort就会有问题