[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LUTask (was Re: LuaSocket, LTN12 and coroutines: how to? (long post)) long as well...
- From: Chris Pressey <cpressey@...>
- Date: Sat, 29 Jan 2005 20:24:45 -0800
On Sun, 30 Jan 2005 02:16:03 +0100
PA <email@example.com> wrote:
> 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...
LUTask.new(aConvolutedObject, function() aConvolutedObject.doIt() end)
For that matter, why wrap tasks around objects in the first place? This isn't Java. :)
> was thinking in terms of @selector instead of actual method
> implementation... anyhow... passing only the object itself will do
> 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() )
> return ivars.routine
> And all is good in the Kingdom! Perhaps. Who knows, really.
> PA, Onnay Equitursay