lua 表双重排序问题

2025-05-05 10:52:24
推荐回答(1个)
回答1:

table.sort(test, function(a,b)
    if a.type ~= b.type then 
        return a.type   else
      return a.number < b.number
   end
end)

类似可以推广到N个同时分组的情况