lua-users home
lua-l archive

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


Hi,

I've written a preliminary version of a patch for Lua 5.0.2 to improve
support of coroutines. Specifically, it lifts the restrictions against
yielding from a metamethod implemented in Lua (except for __gc), and provides
a way to write C functions that callback into Lua code and allow that
code to yield without error. Although existing C functions that call into
Lua code would need to be modified in order to take advantage of this new
capability, in some cases (depending on the complexity of the C functions)
the changes can be quite simple.

C functions which call into Lua and have not been modified will continue
to throw an error if the code that they call attempts to yield, as in
standard Lua.

The intentions here are to enhance the flexibility of coroutines in
Lua without introducing any kind of platform or OS-level dependency.

I am investigating whether this patch can be ported to 5.1...

This patch is quite pre-alpha, but if you would like to try it out,
please feel free... Feedback is appreciated.

http://lua-users.org/wiki/CoroutinesPatch

-Eric