Skip to content
On this page

8.2 -- [Incompatibilities in the Libraries]

  • The function print does not call tostring to format its arguments; instead, it has this functionality hardwired. You should use __tostring to modify how values are printed.
  • The pseudo-random number generator used by the function math.random now starts with a somewhat random seed. Moreover, it uses a different algorithm.
  • By default, the decoding functions in the utf8 library do not accept surrogates as valid code points. An extra parameter in these functions makes them more permissive.
  • The options "setpause" and "setstepmul" of the function collectgarbage are deprecated. You should use the new option "incremental" to set them.
  • The function io.lines now returns four values, instead of just one. That can be a problem when it is used as the sole argument to another function that has optional parameters, such as in load(io.lines(filename, "L")). To fix that issue, you can wrap the call into parentheses, to adjust its number of results to one.