Thanks to who posted in this thread, I did learn something from it. Particularly, I never considered that modulus with a negative divisor might be useful in a real program.
An equivalent way of stating lua's definition of modulus:
a % b returns the number between 0 and b which is congruent to a modulo b. If b is positive, this number is zero or positive, and if b is negative this number is zero or negative.
In particular, it's true that `a % c == b % c` if and only if a is congruent to b mod c, no matter if any of the numbers are negative.
And, lua's definition leads to a natural definition of "div" in the div-mod equation, as pointed out by others.
To me these look like pretty compelling advantages. So for whatever little it's worth, lua's way of doing it has my personal seal of approval. :)
Also it appears the "C" way of doing things is available from `math.mod` library function.