lua-users home
lua-l archive

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




On Friday, August 29, 2014, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2014-08-29 16:05 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
>
> I'm dumb. So, I don't know how I flubbed this so badly, but:
>
> The error returned by create, imHo, should report that it expected a
> "function", not a "coroutine". If that distinction is useful to make, then
> add a note like "this function is the coroutine that runs within the thread"
> or something.
>
> But to me, the effort to be more... contextually correct?... makes this
> error more confusing. "coroutine.create" needs a "function" and there is no
> such value type "coroutine."
>
> Sorry for the flub.

You've just flubbed a little more. Your initial post dealt with the error
message from "status". "create" expects a function, true, but says so:

> th=coroutine.create(42)
stdin:1: bad argument #1 to 'create' (function expected, got number)

Returning to the fact that "status" says it expects a coroutine. I agree that
the error message should say that it expects a thread, because it only tests
whether it gets a thread, and that's enough. It also works if you pass the
main thread, not only a thread created by coroutine.create.


Sometimes, I really frustrate me...

Thanks for your grace. I had wondered why nobody jumped on my original "error". :)