of     2   
chevron_rightchevron_rightchevron_right

KapKing47
#159638156Tuesday, April 07, 2015 9:44 PM GMT

how does Roblox Round the Numbers off? all I can think of is maybe, Convert it into a String and then find the '.' and Numbers after it, then for .floor just takes out the '.' and the Numbers after, for .ceil it would remove the '.' and all the Numbers after it as well, but would do +1 to the Number that they got... "My Life is going Good... but..."
Dannythebedbug
#159638671Tuesday, April 07, 2015 9:50 PM GMT

I'm pretty sure those functions are implemented in native Lua, not just Roblox. If that is the case, then go read Lua's source code.
KapKing47
#159640083Tuesday, April 07, 2015 10:04 PM GMT

mmm... k... feeling lazy to search though Xd "My Life is going Good... but..."
gibbothebee
#159643336Tuesday, April 07, 2015 10:40 PM GMT

It's probably something super complicated. Don't worry about it.
KapKing47
#159643497Tuesday, April 07, 2015 10:42 PM GMT

ah well I done it my way XD u'll be able to check it out soon! XD "My Life is going Good... but..."
Seattlantis
#159643666Tuesday, April 07, 2015 10:44 PM GMT

In my experience .floor is a lot more accurate than .ceil
KapKing47
#159643788Tuesday, April 07, 2015 10:45 PM GMT

hmmm "My Life is going Good... but..."
gibbothebee
#159643860Tuesday, April 07, 2015 10:45 PM GMT

Both are equal in regards to accuracy. Different tasks call for different operations.
cntkillme
#159646137Tuesday, April 07, 2015 11:09 PM GMT

It's not complicated at all, in fact there are many ways to actually do it.
KapKing47
#159646342Tuesday, April 07, 2015 11:11 PM GMT

cnt, be my guest, tell me... 1 comes to mind, Divide... check maybe wat the Numbers after the '.' are and then somehow find a Number that would Neutralize those XD "My Life is going Good... but..."
cntkillme
#159646580Tuesday, April 07, 2015 11:14 PM GMT

local floor = num - (num % 1); num % 1 returns the fractal part (anything after the decimal point) so I just remove it from the main number. That's probably the easiest way in Lua without using math.floor (the easiest way i can think of right now, at least)
AbstractMadness
#159646932Tuesday, April 07, 2015 11:17 PM GMT

function round(num) num = tostring(num) local decpattern = "%p%d+$" local numpattern = "%d+" local dec = num:match(numpattern) local num = num:match(numpattern) dec = tonumber(dec) num = tonumber(num) if dec < .5 then num = num + 1 else num = num end return num end print(round(2.85)) -> 3
KapKing47
#159646963Tuesday, April 07, 2015 11:18 PM GMT

damnit! XD am so Stupid! XD I used String.Manipulation for my math.floor XDDD Convert to String, then back to, Number XD "My Life is going Good... but..."
cntkillme
#159647029Tuesday, April 07, 2015 11:19 PM GMT

No, you really don't want to convert your number into a string then back. It's better to do number stuff on numbers
AbstractMadness
#159647165Tuesday, April 07, 2015 11:20 PM GMT

well i don't know how to do it with math :l
KapKing47
#159647356Tuesday, April 07, 2015 11:22 PM GMT

lol "My Life is going Good... but..."
cntkillme
#159647629Tuesday, April 07, 2015 11:25 PM GMT

Look up a couple replies pls
AbstractMadness
#159647854Tuesday, April 07, 2015 11:28 PM GMT

that's just floor i did a rounding function oops
KapKing47
#159647978Tuesday, April 07, 2015 11:29 PM GMT

lol "My Life is going Good... but..."
AbstractMadness
#159648091Tuesday, April 07, 2015 11:31 PM GMT

also, when do I learn % in school? what subject
cntkillme
#159648167Tuesday, April 07, 2015 11:32 PM GMT

You probably learned it in elementary school. Ever done something like this: 5 / 3 = 1 remainder 2
AbstractMadness
#159648288Tuesday, April 07, 2015 11:33 PM GMT

yeah but then we had to do decimals.. which sucks ass. so what exactly does % do? its been so long since i did that and i think i forgot.
cntkillme
#159648323Tuesday, April 07, 2015 11:33 PM GMT

It returns the remainder, that's all :)
AbstractMadness
#159648471Tuesday, April 07, 2015 11:35 PM GMT

oh dang.. wow i forgot how to do remainders though.. ugh
KapKing47
#159648561Tuesday, April 07, 2015 11:36 PM GMT

lol "My Life is going Good... but..."

    of     2   
chevron_rightchevron_rightchevron_right