Just wondering, is it possible to find the decimal place of a number? For example:
local Number = 1.547 -- Is it possible to make a function that returns 1000 for this (it's decimal place value?)
So you could just pass a decimal to a function and the function returns the decimal place of that number as a whole number (i.e, 0.1 = 10, 0.01 = 100, 0.001 = 1000, ect.)
To do this, you just need to find the amount of numbers past the decimal sign. For every number that there is, that will be a '0' in the decimal placeholder.
Ex;
Afterwards, you can add that onto the back of a '1' and boom, you have the decimal place.
function getPlace(num) local s_num = tostring(num) local zero = "0" num = s_num:sub(s_num:match(".")+1) return tonumber("1"..zero:rep(#tostring(num)-1)); end print(getPlace(1.1)) --> 10 print(getPlace(1.642)) -- >1000