lua-users home
lua-l archive

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



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/