[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUTask (was Re: LuaSocket, LTN12 and coroutines: how to? (long post)) long as well...
- From: PA <petite.abeille@...>
- Date: Sun, 30 Jan 2005 02:16:03 +0100
On Jan 30, 2005, at 01:57, PA wrote:
-- The 'magic' incarnation
local aTask = LUTask.new( aConvolutedObject, aConvolutedObject.doIt() )
Ooops... I just realized that I cannot pass the function itself right
there... as this will have the unfortunate effect of executing it... I
was thinking in terms of @selector instead of actual method
implementation... anyhow... passing only the object itself will do
instead:
local aTask = LUTask.new( aConvolutedObject )
Then the 'routine' method can simply call a default method like 'run':
-- private method to wrap ivars.method in a coroutine
local routine = function()
if not ivars.routine then
ivars.routine = coroutine.create( self.object().run() )
end
return ivars.routine
end
And all is good in the Kingdom! Perhaps. Who knows, really.
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/