lua-users home
lua-l archive

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


> > co = coroutine.create(function() print"test" end)
> > ...
> > Can we get a thread metatable?
> 
> debug.setmetatable(co,{__len=function(thread) return "abc" end})
> print(#co) --> abc

I think the OP wants
	debug.setmetatable(co,{__index=coroutine})
so that he can say co:resume().