lua-users home
lua-l archive

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


> I've had a desire to do a similar thing. [...] My examples are pretty simple:

It's hard to cater for both in the same code.
 
> return function()
>     return ACallback(5, 10)
> end

Try

function freeze(f,a,b)
	return function() return f(a,b) end
end

ACallback=print
freeze(ACallback,10,20,30)(100,200)

> function(value)
>     TheCallback(value, 10)
> end

Try

function freeze(f,a)
	return function (x) return f(x,a) end
end

TheCallback=print
freeze(TheCallback,10,20,30)(100,200)