[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: fun with coroutines
- From: "C.S. Brooks" <chrisb@...>
- Date: Tue, 29 Oct 2002 14:52:23 -0700
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
coroutine?
-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
http://www.fogsworkshop.com