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 (http://vlists.pepperfish.net/cgi-bin/mailman/private/lua-l-lists.lua.org/2012-June/023709.html ) email which states

	Yes, L is in an invalid state, because it yielded. While it is suspended,
	you cannot change its stack. More specifically, the thread "thinks"
	it is running a Lua function (because it was inside a Lua function when
	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