|
|
@ -13,6 +13,7 @@ end |
|
|
|
|
|
|
|
|
|
|
|
function Quantum.Format.Money( num ) |
|
|
|
function Quantum.Format.Money( num ) |
|
|
|
if( num == nil ) then return addMoneyVal( 0 ) end |
|
|
|
if( num == nil ) then return addMoneyVal( 0 ) end |
|
|
|
|
|
|
|
|
|
|
|
if( num >= 1e14 ) then |
|
|
|
if( num >= 1e14 ) then |
|
|
|
return addMoneyVal( num ) |
|
|
|
return addMoneyVal( num ) |
|
|
|
elseif( num <= -1e14 ) then |
|
|
|
elseif( num <= -1e14 ) then |
|
|
@ -20,12 +21,12 @@ function Quantum.Format.Money( num ) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
num = tostring( math.abs( num ) ) |
|
|
|
num = tostring( math.abs( num ) ) |
|
|
|
local sep = sep || "," |
|
|
|
local sep = sep || "," |
|
|
|
local dp = string.find( num, "%." ) || #num + 1 |
|
|
|
local dp = string.find( num, "%." ) || #num + 1 |
|
|
|
|
|
|
|
|
|
|
|
for i = dp - 4, 1, -3 do |
|
|
|
for i = dp - 4, 1, -3 do |
|
|
|
num = num:sub( 1, i ) .. sep .. num:sub( i + 1 ) |
|
|
|
num = num:sub( 1, i ) .. sep .. num:sub( i + 1 ) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
return ( negative && "-" || "" ) .. addMoneyVal( num ) |
|
|
|
return ( negative && "-" || "" ) .. addMoneyVal( num ) |
|
|
|
end |
|
|
|
end |