|
Post by swoogi on Jan 31, 2020 21:13:43 GMT
Hello, I wrote a function and I want not any output with "12.123345342345234" I only need time left in Minutes or with only 12.12 (2 digits after the .)
Can someone help me how to do that?
function runsleep()
local randomTime = math.random(4*60, 20*60)
local randometimecount = 0
local a=5
toast("Schlafe für insgesamt: " .. randomTime/60 .. " Minuten")
while randometimecount < randomTime do
local leftime = randomTime/60-randometimecount/60
toast("sleep time for " .. leftime .. "minutes" )
randometimecount = randometimecount+a
sleep(a)
end
end
|
|
|
Post by AnkuLua on Jan 31, 2020 23:10:59 GMT
number = 0 + string.format("%2.2f", 12.123345342345234) or number = 0 + string.format("%2.2f", 0 + "12.123345342345234")
|
|
|
Post by oomkoos on Feb 1, 2020 14:04:27 GMT
twoDec = math.floor(decimalNumber*100) / 100
should also work , altho math.floor just cut it doesn’t round it off
|
|