lua-users home
lua-l archive

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


Lua 4.0 (beta) is now available for downloading at
        http://www.tecgraf.puc-rio.br/lua/ftp/lua-4.0-beta.tar.gz
        ftp://ftp.tecgraf.puc-rio.br/lua/lua-4.0-beta.tar.gz
        http://csg.uwaterloo.ca/lua/ftp/lua-4.0-beta.tar.gz
        ftp://csg.uwaterloo.ca/pub/lhf/lua/lua.tar.gz

The other mirrors will be updated soon, hopefully.

The distribution includes an updated reference manual in HTML.
The PostScript and PDF versions in the site are still for version 3.2.

* New in version 4.0 (beta)
  --------------------------
  + new API: fully re-entrant, simpler, and more efficient.
  + new "break" and "for" statements (both numerical and for tables).
  + cleaner virtual machine -- at least 20% faster.
  + uniform treatment of globals: globals are now stored in a Lua table.
  + improved error messages.
  + no more '$debug': full speed *and* full debug information.
  + reduced memory usage.
  + non-recursive garbage-collector algorithm.
  + code now compiles unmodified as both ANSI C and C++.
  + improved support for 16-bit machines (we hope).
  and more!

Lua 4.0 is a major new version (4.0 beta is a field test; we don't expect
to make any visible changes from 4.0 beta to 4.0 final).

The language itself changed only a little ("break" and "for" statements and
new semantics for forwarding the return values of functions are the major
changes), but the C API and the implementation have changed a lot, with a
new, simpler C-Lua protocol, a new, better code generator and a new, faster
virtual machine.  Also, the built-in functions are now in the standard
library, and so Lua's core is even smaller (and faster)!

Those that program only in Lua should quickly adapt to Lua 4.0: many uses of
"while", "foreach" and "foreachvar" can now be rewritten using "for" in a
much cleaner way.  Also, global variables are now stored in an ordinary Lua
table, making the treatment of globals and table fields more uniform.

Lua programmers will also welcome the improved error messages and the
presence of full debug information without '$debug' (which paid a speed
penalty in 3.2). Lua programs now run at full speed *and* errors are now
reported fully (name of variable or field that caused the error, along with
line numbers in the stack traceback).

Unfortunately, those that use the C API will have to change their code.
First, all functions now require an explicit Lua state as the first argument,
because the API is now fully re-entrant.
Second, the C-Lua protocol has changed to be a simpler, stack-based protocol.
lua_Objects have vanished and have been replaced by indices into the stack.
This new protocol is simpler to use and understand and is more efficient.
Hopefully, doubts about why the stack may overflow (as in a recent posting)
will be a thing of the past. :-)

Also, the old API cannot be mapped easily into the new API, and so lua.h
no longer contains compatibility macros. We are sorry about this, but
we think that this is the time to adapt your C code, once and for all.

Moreover, libraries generated by tools such as tolua and SWIG will be
automatically updated once these tools have been updated to 4.0.
tolua should be ready when we release Lua 4.0 (final).

Please report any problems to lua@tecgraf.puc-rio.br.

Thanks.
--lhf