From 6777df634d9d9a3e2bd9ff58090496bb25583782 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Sat, 12 Oct 2024 23:21:29 +0200 Subject: [PATCH] Fix sort mode overflow --- itemcontroller.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itemcontroller.lua b/itemcontroller.lua index d40d0dd..f157d74 100644 --- a/itemcontroller.lua +++ b/itemcontroller.lua @@ -274,7 +274,7 @@ local PAGES = { return function(a, b) local aRes = func(a) local bRes = func(b) - return (aRes == bRes and tiebreaker ~= nil and tiebreaker(a, b)) or ((aRes > bRes) ~= invert) + return (aRes == bRes and tiebreaker ~= nil and tiebreaker(a, b)) or ((aRes < bRes) ~= invert) end end @@ -701,7 +701,7 @@ local PAGES = { sortButton:setOnClick(function() print("Reorganizing...") - pageState.sortMode = (pageState.sortMode + 1 + #SORT_MODE) % #SORT_MODE + pageState.sortMode = (pageState.sortMode % #SORT_MODE) + 1 reloadState() return true end)