lua-users home
lua-l archive

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

On Fri, Apr 28, 2017 at 8:54 AM, Dirk Laurie <> wrote:
> Inspired by Adel's original post on the thread "Beginner to Programming",
> I have put together:

Adding a complete definition for a coroutine and thread seems within
reach of the apparent intent, no? You may draw the goal post as you
wish (I'm sure that you don't want this to become a manual) but
completeness would be a reasonable goal.

 I'll get it wrong, but:

Thread: 1) One of Lua's basic types 2) A Lua state. In the Lua
scripting language, a thread value contains an execution state that is
initialized with the the `coroutine.create` and a function, which
serves as the thread's main function. The thread may be in one of four

 * normal: initialized but not running
 * running: the current thread
 * suspended: a thread that has been yielded with coroutine.yield
 * dead: the execution is finished because the main function exited
cleanly or there was an error

Coroutine: A function that contains one or more calls to
`coroutine.yield`. A coroutine is executed in a thread that is created
by `coroutine.create`.


As I send this email, I know that this is wrong. One of the fantastic
things about your index is that it forces the definition of difficult
terms to grasp. I think that the Luaverse will be much better off if
you tackle `coroutine` and `thread`.

Thanks for doing this Dirk! Hopefully my suggestions are helpful and make sense.

Andrew Starks