• KD ratio rounding fail
    5 replies, posted
This question definitely belongs here, but for my scoreboard I have a KD ratio and I need it to round after .00 and not 1.0090880, etc. math.Round, rounds it to a int and that doesnt please me. Help please? Thank you.
I really don't know if this would work, but you could try string.sub(tostring(number) , 0 , 4) As far as I know, there isn't a math function that allows you to do this; which is why you convert it to a string.
You can mess with string.format if you want it to round only up to two decimals. Or you could try this.. [lua]num_rounded = math.floor( number * 10^decimals ) / 10^decimals;[/lua] Though, my math is way off today, so it might not work. [b]Edit:[/b] [lua]num_rounded = tonumber( string.format( "%."..decimals.."f", number ) )[/lua] Also works.
Try doing this: [lua]local ph = var * 100 math.Round( ph ) var = ph / 100[/lua]
Thanks, I used something similar to The last 2 posts, (I don't honestly want to have a string, but if it leads to that).
Hi, I am Andres Kramack from [url]http://www.cathybarryadultstore.com/[/url]. It's a 'pleasure' serving the public if you know what I mean and this message is Here at Cathy Barry Adult Store, we offer a wide variety of dildos that come in all sizes from goblin-sized dicks to black-man draconic dicks. I know at Facepunch everyone loves good old dicks which is why [B]I[/B] personally offer anyone with an association with Facepunch Forums a 50% discount code "DIL4FACEPUNCH". Don't forget, this offer lasts until the next Garry's Mod update which we so much love. Here are pictures of our products just for you! [IMG]http://pic.esmatube.com/imgs/a/g/t/x/x/giant_dildo_in_my_ass_part_ii-3_tmb.jpg[/IMG] [IMG]http://pic.esmatube.com/imgs/a/d/d/h/r/bbw_giant_dildo_squat_25cm_round-3_tmb.jpg[/IMG] [IMG]http://xxxdessert.com/tube/contents/videos_screenshots/15000/15261/preview.mp4.jpg[/IMG] [IMG]http://g04.a.alicdn.com/kf/HTB1JlHlIpXXXXaJXVXXq6xXFXXXo/Silicone-Huge-Dildos-Vibrator-for-woman-shake-Horse-Dildos-penis-swith-sucker-african-Dong-dildos.jpg[/IMG] Sponsored Images: [IMG]http://45.media.tumblr.com/f81f8d61fa253dc804edb423c8ab149f/tumblr_mfbk96QAug1rvbfkuo1_500.gif[/IMG] [IMG]http://49.media.tumblr.com/9110819111aa37acf4cd1c9d5341dd97/tumblr_nc4hqkdESo1skwv6ko1_500.gif[/IMG] [IMG]http://1.bp.blogspot.com/-gueWbSnnsIc/UUtenyLS0oI/AAAAAAAANF4/L4aZnTrMaqs/s1600/dermatologists-hate-her.jpg[/IMG] [IMG]http://static.fjcdn.com/pictures/Gym+leaders+hate+him_ab471d_5017861.jpg[/IMG] [IMG]https://static.fjcdn.com/comments/That+one+with+the+lamp+got+me+_e68beb19422eea14289caa5f4d6dffb7.jpg[/IMG] Got any questions? Visit my Steam Profile! [url]http://steamcommunity.com/id/Robotboy655[/url]
Sorry, you need to Log In to post a reply to this thread.