Home > database >  How can I get the quotient of a division in lua?
How can I get the quotient of a division in lua?

Time:08-26

For my game in roblox, I need the quotient of a division. For example the quotient of 20/3 is 6 and 40/2 is 20. Is there a way to do this using a function?

CodePudding user response:

Look at math.modf(a/b), which will return two values, the intergral and the fractional remainder.

a = 20
b = 3
q, _ = math.modf(a/b)
print(q)

will result in 6

  • Related