lua-users home
lua-l archive

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


> ... this typically will depend strongly how you handle your coroutines
> and your message handling in C... .

> There is no "standard way" to handle coroutines in C, or do the
> yielding in C, you should think about this better carefully... .

To be clear this is about taking a coroutine and copying it, perhaps a pseudocode example will help you understand:

local function f()
   coroutine.yield(1)
   return 2
end

local A = coroutine.create(f)

coroutine.resume(A) -- returns 1

local B = coroutine.clone(A)  -- hypothetical 

coroutine.resume(A) -- returns 2

coroutine.resume(B) -- returns 2