lua-users home
lua-l archive

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


<code>
function hook(event)
    print(event);
end
 
function test1()
end
 
function test()
    return test1();
end
 
debug.sethook(hook, "cr");         
test();
</code>
 
The output of the above code is following:
call
call
return
 
The count of return hook is not same as the count of call hook.
I found that the return or tailretun event is missing when there is tail call.
Because of this bug, it's impossible to collect the function's execute time(between call hook and return hook) of lua code.
 
2016-06-05

cx0cx2001