diff --git a/gui/auction_listing.lua b/gui/auction_listing.lua index e61ebf9..fb58d0a 100644 --- a/gui/auction_listing.lua +++ b/gui/auction_listing.lua @@ -674,7 +674,7 @@ local methods = { self.isSorted = nil self:SetSelectedRecord(nil, true) - sort(self.records, function(a, b) return sorting.multi_lt(temp-A(a.search_signature, tostring(a)), temp-A(b.search_signature, tostring(b))) end) + sort(self.records, function(a, b) return sorting.multi_lt(a.search_signature, b.search_signature, tostring(a), tostring(b)) end) local records = self.records if getn(records) == 0 then return end diff --git a/tabs/post/core.lua b/tabs/post/core.lua index ccd3eee..39c5691 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -148,20 +148,20 @@ function update_auction_listing() end sort(auction_rows, function(a, b) return sorting.multi_lt( - temp-A( a.record.unit_buyout_price == 0 and huge or a.record.unit_buyout_price, + b.record.unit_buyout_price == 0 and huge or b.record.unit_buyout_price, + a.record.unit_blizzard_bid, + b.record.unit_blizzard_bid, + a.record.stack_size, + b.record.stack_size, + b.record.own and 1 or 0, - a.record.duration - ), - temp-A( - b.record.unit_buyout_price == 0 and huge or b.record.unit_buyout_price, - b.record.unit_blizzard_bid, - b.record.stack_size, - a.record.own and 1 or 0, + a.record.own and 1 or 0, + + a.record.duration, b.record.duration - ) ) end) end diff --git a/util/sort.lua b/util/sort.lua index 648a227..b47d362 100644 --- a/util/sort.lua +++ b/util/sort.lua @@ -14,16 +14,15 @@ function public.compare(a, b, desc) end end -function public.multi_lt(xs, ys) - local i = 1 - while true do - if xs[i] and ys[i] and xs[i] ~= ys[i] then - return xs[i] < ys[i] - elseif not xs[i] and ys[i] then +function public.vararg.multi_lt(arg) + for i = 1, getn(arg), 2 do + if arg[i] and arg[i + 1] and arg[i] ~= arg[i + 1] then + return arg[i] < arg[i + 1] + elseif not arg[i] and arg[i + 1] then return true - elseif not ys[i] then + elseif not arg[i + 1] then return false end - i = i + 1 - end + end + return false end \ No newline at end of file