lua-users home
lua-l archive

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


On Sat, Jul 9, 2011 at 01:55, Dirk Laurie <dpl@sun.ac.za> wrote:
> 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
>
>

Well, I was thinking status would be a field instead.

-- 
Sent from my toaster.