lua-users home
lua-l archive

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


On Tue, Jun 07, 2005 at 10:38:48AM -0300, Luiz Henrique de Figueiredo wrote:
> > Another: there doesn't seem to be a way to access return values.  They're
> > on the stack, and the core code appears to know how many values on the stack
> > are return values, but there's no way to find this out from a hook.
> 
> This is really hard. How would this work for a function that ends like this?
> 	return f()

Tail calls and regular returns already have different hooks, with different
behavior.  I want to be able to find out where return values start in
HOOKRET; that information is right there in the function that calls the
hook itself ("firstResult").

(For tail calls, just logging them is enough: "function a called
function f; function f returned 10; a tail call returned" is enough
to infer that "a" also returned 10.)

-- 
Glenn Maynard