lua-users home
lua-l archive

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



Welcome aboard Matthew,

I'm not a gamer, but I'll stick my neck out.

Matthew Harmon wrote:
  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.

Yes.

  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?

Yes, it's okay.

  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?

Sure, use one lua_State and many threads. Then you can share some basic settup and move values between threads if you want to.

- Peter