Lua Five Alpha To Beta

lua-users home
wiki

VersionNotice: This page pertains to developmental versions of Lua (5.0 alpha and beta).

Incompatibilities

Soon we will release Lua 5.0 beta. Here is a list of incompatibilities from 5.0 alpha to 5.0 beta. (Most of them relate to coroutines; this is an area that is still green in Lua.)

LUA_API lua_State *lua_newthread (lua_State *L);

leaves the new thread on the stack. All threads but the main one are garbage collectible. For coroutines, this is just what we need. Other multi-threaded systems (like LuaThreads??) may store threads in the registry, for instance, to avoid their collection.

x = coroutine.create(function (a,b,c) print(a,b,c) print(coroutine.yield()) print(coroutine.yield()) end)

coroutine.resume(x, 1, 2, 3) --> 1, 2, 3 coroutine.resume(x, 10) --> 10 coroutine.resume(x, 4, 5) --> 4, 5 print(coroutine.resume(x)) --> false cannot resume dead coroutine

-- Roberto


New Features

Here is a list of novelties in 5.0 beta (compared to 5.0 alpha). They should create no incompatibilities in "normal" programs.


RecentChanges · preferences
edit · history
Last edited March 16, 2009 10:23 am GMT (diff)