As well, if you add 1 to the MAX_INT value in Lua should not wrap around.
It's a fact that Lua implementations tried to optimize the operations on its "number" type to avoid using floatting points as much as possible, so that it could use the integer arithmeric of C or C++. But the number type is larger in range and precision than that. In some cases, Lua integers cannot fit the native integers in C and will still become floatting points (possibly with loss of precision and rounding for the lowest bits of large absolute values).
Optimization of operations on Lua numbers is then tricky, and implementations should care about it (and should raise overflows only in case of overflows of floatting points with a too large exponent, or at least returning signed "infinite" values which are also valid Lua number values).
If Lua code wants to wrap around, I really think that Lua should provide a scoping declaration or annotation for that (we've already spoken about weak references with "*toclose" which now requires such annotation). It's high time for Lua to think about generalizing a syntax for annotations (not just for declarations of "*toclose" variables, but also for expressions) and it's another argument for changing "*toclose" into "@toclose".
I still propose the syntax "@ANNOTATION_ID" or "@{
ANNOTATION_ID, parameters...}" for these annotations, to be used before a declared name or before a subexpression in parentheses, rather than "*ANNOTATION_ID" just before a declared name.