lua-users home
lua-l archive

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


I don't see anything wrong with this. What did you expect? co1 and co2
are running in different Lua threads but they share the registry and the
table of globals. (They don't have to share, but they do by default.)
--lhf

>========================
>local function foo(a)
>    errid(a)
>    print("set", a)
>    coroutine.yield()
>    print(errid())
>    return
>end
>
>local co1 = coroutine.create(foo)
>local co2 = coroutine.create(foo)
>
>coroutine.resume(co1, 11)
>coroutine.resume(co2, 22)
>
>coroutine.resume(co1)
>coroutine.resume(co2)
>========================
>
>Output:
>set 11
>set 22
>22
>22