Skip to content

Commit

Permalink
Fix error when formatting non-number
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed Dec 30, 2024
1 parent 1075480 commit 90ab309
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resmon/locale.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ end
function locale_module.format_number(n)
-- credit http://richard.warburton.it
local left, num, right = string.match(n, '^([^%d]*%d)(%d*)(.-)$')
if not left or not num or not right then
return tostring(n)
end
return left .. (num:reverse():gsub('(%d%d%d)', '%1,'):reverse()) .. right
end

Expand Down

0 comments on commit 90ab309

Please sign in to comment.