|
| 31 Dec 2011 06:55 PM |
say i do 9/2 the remainder is 1 how do i see it in general lua?
I want to do it for a decimal to binary convertor. And i dont want to store everything in a table... |
|
|
| Report Abuse |
|
|
| |
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 31 Dec 2011 07:19 PM |
print(9%2) >1
% gets the remainder of the division of two integers. |
|
|
| Report Abuse |
|
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 31 Dec 2011 08:24 PM |
you can also use math.mod()
print(math.mod(9,2)) |
|
|
| Report Abuse |
|
|
Chronok
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 402 |
|
|
| 31 Dec 2011 08:34 PM |
@RA2lover
Once again, I believe you mean math.fmod.
{ Chronok, novitiate scripter/programmer. } |
|
|
| Report Abuse |
|
|