lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Lua 3.1 is now available for *alpha* testing at

This package includes updated documentation in lua/doc.
See below for a list of major changes and incompatibilities.
Please report any problems.

* Changes from version 3.0 to 3.1 alpha
  + NEW FEATURE: anonymous functions with closures (via "upvalues").
  + new syntax:
    - local variables in chunks.
    - better scope control with DO block END.
    - constructors can now be also written: { record-part; list-part }.
    - more general syntax for function calls and lvalues, e.g.:
  + major code re-organization and clean-up; reduced module interdependecies.
  + support for multiple contexts.
  + new traversal functions "foreach" and "foreachvar".
  + changing lua to use doubles instead of floats is now trivial.
  + complete debug information stored in pre-compiled chunks.

* Incompatibilities from Lua 3.0 to 3.1 alpha

- To support multiple contexts, Lua 3.1 must be explicitly opened before used.
  However, all standard libraries check whether Lua is already opened, so any
  program that opens at least one standard library before using Lua API does
  not need to be modified.

- Function "dostring" no longer accepts an optional second argument, with a
  temporary error method. This facility is now provided by function "call".

- Function "gsub" no longer accepts an optional fourth argument (a callback
  data, a table). Closures replace this feature with advantage.

- The syntax for function declaration is now more restricted;
  for instance, the old syntax "function f[exp] (x) ... end" is not accepted in
  3.1. In these cases, programs should use an explicit assignment instead, like
  "f[exp] = function (x) ... end".

- Old pre-compiled code is obsolete, and must be re-compiled.

- The option "a=b" in Lua stand-alone now sets "a" to the *string* "b",
  and not to the value of "b".