lua-users home
lua-l archive

yield, resume and the like

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


I?m a Lua newbie? but after only 45 minutes I have it doing useful things.
I?m glad simpler is better is still somebody?s mantra out there! Anyway,
like many others I am using Lua to run game scripts. As such, I have some
questions that I didn?t see clarified in the archives. Talking 5.0 here?
 1) Is a coroutine just a Lua wrapper for handling threads? From the
documentation, I?m not exactly sure if this is the case, but a quick peek at
the code seems to imply this.
 2) Similarly, the documentation implies that only coroutines can be
yielded and resumed. However, I am yielding and resuming a thread just
fine. Is this ok?
 3) If I want to have 10 or 20 scripts going at once (usually in a yield
state), I assume I should fire off a new thread for each, and not create a
new Lua state for each?
Many thanks

AltStyle によって変換されたページ (->オリジナル) /