Advertisement
ScratchMonkey

GNOBESY sort comparison

Aug 1st, 2024
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | Gaming | 0 0
  1. local function CompareItems(lItem, rItem)
  2.     if rItem.id == nil then
  3.         return true;
  4.     elseif lItem.id == nil then
  5.         return false;
  6. --    elseif lItem.quality ~= rItem.quality then
  7. --        return (lItem.quality > rItem.quality);
  8.     elseif lItem.class ~= rItem.class then
  9.         return (lItem.class < rItem.class);
  10.     elseif lItem.subclass ~= rItem.subclass then
  11.         return (lItem.subclass < rItem.subclass);
  12. -- [KAP] put ilvl and quality here, major sort on class/subclass to group similar items together
  13.     elseif lItem.itemLevel ~= rItem.itemLevel then
  14.         return (lItem.itemLevel < rItem.itemLevel);
  15.     elseif lItem.quality ~= rItem.quality then
  16.         return (lItem.quality > rItem.quality);
  17.     elseif lItem.name ~= rItem.name then
  18.         return (lItem.name < rItem.name);
  19.     elseif lItem.count ~= rItem.count then
  20.         return (lItem.count >= rItem.count);
  21.     else
  22.         return true;
  23.     end
  24. end
Tags: Warcraft
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement