Incompatibilities in the Language
- The coercion of strings to numbers in arithmetic and bitwise operations has been removed from the core language. The string library does a similar job for arithmetic (but not for bitwise) operations using the string metamethods. However, unlike in previous versions, the new implementation preserves the implicit type of the numeral in the string. For instance, the result of
"1" + "2"now is an integer, not a float.
- Literal decimal integer constants that overflow are read as floats, instead of wrapping around. You can use hexadecimal notation for such constants if you want the old behavior (reading them as integers with wrap around).
- The use of the
__ltmetamethod to emulate
__lehas been removed. When needed, this metamethod must be explicitly defined.
- The semantics of the numerical for loop over integers changed in some details. In particular, the control variable never wraps around.
- A label for a goto cannot be declared where a label with the same name is visible, even if this other label is declared in an enclosing block.
- When finalizing an object, Lua does not ignore
__gcmetamethods that are not functions. Any value will be called, if present. (Non-callable values will generate a warning, like any other error when calling a finalizer.)