lua-users home
lua-l archive

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

I'd like to use the debug API for probably the most simple possible
case: logging function calls and returns, with parameters and return

One problem I'm seeing: parameters aren't available in LUA_HOOKCALL.  I
can hack around this by enabling LUA_MASKCOUNT at 1 when LUA_HOOKCALL
comes in, grabbing the info on the next hook and disabling the extra hook,
but that seems evil.  Is there a reason LUA_HOOKCALL is called before
setting up parameters for the call?

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.  Is
there a way to do this?  If not, what would be a correct way to implement it?

Glenn Maynard