[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: coroutine metatable
- From: "Duncan Cross" <duncan.cross@...>
- Date: Fri, 9 Nov 2007 11:44:35 +0000
On Nov 9, 2007 11:42 AM, Roberto Ierusalimschy <email@example.com> wrote:
> > Is there a reason why coroutines don't have a metatable similar to
> > strings so that they automatically inherit the coroutine table?
> > Such that you could do:
> > local hi = coroutine.create(function() end);
> > hi:resume()
> It does not seem very useful. More often than not we create the
> coroutine with coroutine.wrap, so that we resume it with 'hi()'. To
> yield, there is no coroutine to apply the operation.
> -- Roberto
How about giving functions a metatable with coroutine.wrap and
string.dump in it?