[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why coroutine can't be indexed?
- From: Dirk Laurie <dpl@...>
- Date: Sat, 9 Jul 2011 09:55:57 +0200
On Sat, Jul 09, 2011 at 04:13:06AM +0200, HyperHacker wrote:
> Just curious why, at least in Lua 5.1, one has to write:
> coroutine.status(co)
> instead of:
> co.status
> and similar? The latter seems a lot more Lua-like.
Function call without parentheses? No-no. But I can see a case
for co:status(), etc. You can DIY with:
> debug.setmetatable(co,{__index=coroutine})
All coroutines then support object-oriented syntax sugar.
Dirk