local temp = {}
local arr = {5,"2",1}
function temp.sortFunction(a,b)
if(tonumber(a) > tonumber(b)) then -- 从大到小排序
return true
end
return false
end
table.sort( arr, temp.sortFunction)
for i = 1 , #arr do
print(arr[i])
end
lua table排序
最新推荐文章于 2024-05-23 21:41:49 发布