lua-users home
lua-l archive

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

I'm using coroutines in lua 5. They work great for what I'm doing, and are
amazing. But, I have a few questions:

-What does the magic value which coroutine.create() returns mean? It seems
to be a pointer to a c function, which is always the same. How does lua know
how to use this to restart a running coroutine? (Is this related to
"upvalues" somehow? I've read and reread all the help I can find about
upvalues, but still fail to comprehend what they do.) If I have an array of
running coroutines (i.e. an array of the "magic values"), how can I tell
which is which?

-Is there a way to get the "magic value" for the currently running

-How do I kill a couroutine which is *not* the currently running one?

-When I call a coroutine, can I find out if it has "return"ed, or yield()ed?

Thanks in advance!

C.S. Brooks
Professor Fog's Workshop