lua-users home
lua-l archive

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

On 22-08-2022 13:12, Luiz Henrique de Figueiredo wrote:

Or is there a function in Lua I could "wrap" for this kind of tracing?

function WRAP(f)
        return function (...)
                print("WRAP in ",...)
                local t=table.pack(f(...))
                print("WRAP out",table.unpack(t))
                return table.unpack(t)

function f(x,y,z)
        return x+y+z,x*y*z



Thank you, I was afraid that this was the option I had to go for. This is what I'm doing from C right now. 
I have to do this for all functions, so I have to figure out a way to automatically wrap new functions (local, 
in tables and global) later on then. 
Thank you!