• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua How to format gold coins

volcomfaria

New Member
Joined
Dec 30, 2008
Messages
4
Reaction score
1
Hey guys!

I wanted to know how I could format a quantity of gold coins and show a message with the amount separating the "kk", "k", "gold coins".

Exemple:
Lua:
number: 1255100

The message that will appear : "1kk, 255k and 100 gold coins."


I've been trying for a while but with no success. Thanks for listening.
 
Lua:
function shortnumberstring(n)
    if n >= 10^6 then
        return string.format("%.2fkk", n / 10^6)
    elseif n >= 10^3 then
        return string.format("%.2fk", n / 10^3)
    else
        return tostring(n)
    end
end

this might work...

edit: sorry, I didn't understood your request at first :D
 
Last edited by a moderator:
Back
Top