vendredi 20 juillet 2018

How do you replace all of the digits with 0 AFTER the first digit?

One of the topics I'm struggling with is how to replace an integer or a number: 1582

To change the numbers AFTER the first digit (which is 1 in this case) to 0. I'm able to turn it into a string but I just need the numbers after the the first digit of the number to turn into 0 (I don't need :find)

I'm developing a ROBLOX game that uses the dictionary numbers abbreviations: k, m, b, t, qd and qn. Which I'm using :gsub to find a certain amount of 0's and change it into the compatible abbreviation. For example:

Player's money: 10000000

Script: tostring(PlayersMoney):gsub("000000", " M")

Player's money: 10 M (stands for millions)

Aucun commentaire:

Enregistrer un commentaire