lua-users home
lua-l archive

Re: Error Text Suggestion for coroutine.status in 5.3

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


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.

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