lua-users home
lua-l archive

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

> I'm trying to learn more about the requirements of yield/resume and 
> found this ( 
> ) email which states
> 	Yes, L is in an invalid state, because it yielded. While it is
>	you cannot change its stack. More specifically, the thread "thinks"
>	it is running a Lua function (because it was inside a Lua function
>	it yielded), so it is not ready to accept API operations.
> I have the following script which is evaluated in its own thread and 
> the yield* functions will yield for an unspecified amount of time
>  function foo()
>    for i = 1, 3 do
>      yield1("test", i)
>    end
>  end
>  function bar()
>    t = { "test", "hello" }
>    yield2(t)
>  end
>  yield3()
> While the script is yielded inside of yield3, can function foo or bar 
> be called? And the same would follow for yield1 or yield2? If I can't 
> enter L while it's yielded would it work if I made a new thread each time?
> John

The message you are referring to is related to the C side api, not to
from Lua scripts, which your examples seem to relate to.
So with 'which is evaluated in its own thread', do you mean with 'thread',
an OS thread, or a
Lua coroutine?