lua-users home
lua-l archive

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


Peter Bradshaw wrote:
> 1. lua_sethook and coroutines

Hooks are set per-thread and not globally. This has been mentioned in
another list thread recently and Roberto indicated that it may be more
reasonable to have global hooks. I don't know whether this will be
changed in 5.1 (but I would like to see this, too).

In the meantime you have to wrap the coroutine.create/wrap functions with
your own functions and set the hook of the new thread. Dito if you are
calling lua_newthread() from C.

> 2. co-routine return values. 

Here is simple example:

function f(a,b,c)

print(coroutine.resume(t, 1, 2, 3))  --->   a=1, b=2, c=3

                          1, 2, 3    <---   coroutine.yield(a, b, c)

==> true 1 2 3

coroutine.resume() calls the coroutine with error catching turned on
(similar to what pcall() does), so you get an additional first return
value that indicates success or failure of the coroutine call.

> 3. nice variable dumper. 

Someone else will have to answer this one.