Hello! I am making code for my simulator, and I need to make scripts that can handle really large values.
I need to find a way to convert a scientific notation (ex: 4.3462346e+14) to an integer (I have no idea what that number would be as an integer, but it would look like this: 4434534654634563456)
I am trying to use string.format, but I am not sure how one would set it up
string.format(tostring(tonumber(player.privstats.Cash.Value) + amount),"%c") -- I need to input an integer and add an amount. However, if the added amount throws the integer into a scientific notation, I need to be able to convert it back. As you can see, I tried string.format but that does not seem to work.
It’s short for “float”, which is what some other languages store a decimal number as. %i would also work if you want to force it to display as an integer. Here’s a list of formatter codes: (Unsure how complete this is)
A simple directive is the character % plus a letter that tells how to format the argument: d for a decimal number, x for hexadecimal, o for octal, f for a floating-point number, s for strings, plus other variants. Between the % and the letter, a directive can include other options, which control the details of the format, such as the number of decimal digits of a floating-point number: