diff --git a/imports/math/shared.lua b/imports/math/shared.lua index ace7896f..e4782f1c 100644 --- a/imports/math/shared.lua +++ b/imports/math/shared.lua @@ -90,4 +90,13 @@ function math.tohex(n, upper) return upper and n:upper() or n end -return lib.math +---Converts input number into grouped digits +---@param number number +---@param seperator? string +---@return string +function math.groupdigits(number, seperator) -- credit http://richard.warburton.it + local left,num,right = string.match(number,'^([^%d]*%d)(%d*)(.-)$') + return left..(num:reverse():gsub('(%d%d%d)','%1' .. (seperator or ',')):reverse())..right +end + +return lib.math \ No newline at end of file