[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Monitoring function calls from C in 5.1
- From: Sean Conner <sean@...>
- Date: Mon, 22 Aug 2022 15:27:47 -0400
It was thus said that the Great Sean Conner once stated:
> It was thus said that the Great bas @ lua-list once stated:
> > > Consider my ctrace at
> > > https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#ctrace
> >
> > That’s a useful tool, which will aid my solution further; however I would
> > like to do a similar thing with any and all Lua functions. i.e., I want to
> > trace calls to `print` and the arguments+results of those calls, is there
> > a way of using lua_Hook safely and having access to the arguments and
> > results? Or is there a function in Lua I could “wrap” for this kind of
> > tracing?
>
> Here's a proof-of-concept using the debug module from Lua:
[ snip ]
Sorry, I forgot you were asking for Lua 5.1. The code presented only
works for Lua 5.4.
-spc