Ok, my intention was to write such a function function modulus(n, d) return n - (q = math.floor(n/d)) * d, q; end is there any means to write it down just as simple? r, q = modulus(10, 3)