lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Native integer support in lua...


Integer division with the / operator would aways return a number, NOT an
integer.  For integer division resulting in an integer result and remainder
you would need to use the idiv(a,b) function.


i = 100 / 2

would return the number 50.0.


i,r  = idiv(101,2)

would return the integers 50 and 1 respectively.


i = imod(a,b)

Would return the integer modulus of the values passed in a and b.