Skip to content

Commit

Permalink
Fix integer overflow error
Browse files Browse the repository at this point in the history
Fixes WA#19
  • Loading branch information
nebularg committed May 11, 2024
1 parent 5acf7ca commit 6dc26f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion BetterAddonList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,11 @@ do

-- pseudo natural sorting
local function pad(s)
return ("%04d"):format(tonumber(s))
local n = tonumber(s)
if n < 1000 then
return ("%04d"):format(n)
end
return s
end
local function natsort(a, b)
return a:gsub("(%d+)", pad):lower() < b:gsub("(%d+)", pad):lower()
Expand Down
6 changes: 5 additions & 1 deletion BetterAddonList_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ do

-- pseudo natural sorting
local function pad(s)
return ("%04d"):format(tonumber(s))
local n = tonumber(s)
if n < 1000 then
return ("%04d"):format(n)
end
return s
end
local function natsort(a, b)
return a:gsub("(%d+)", pad):lower() < b:gsub("(%d+)", pad):lower()
Expand Down

0 comments on commit 6dc26f0

Please sign in to comment.