[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: debug hook callback is not called from __gc metamethod
- From: Paul K <paul@...>
- Date: Mon, 18 Sep 2017 22:03:26 -0700
Hi All,
I'm running the following script and no debug hook events are
generated from the __gc metamethod (even though the lines do get
executed):
do
local a=setmetatable({},{__gc=function()
print("GC") -- 3
end})
end
debug.sethook(function(...) print(...) end,"clr")
collectgarbage("collect") -- 7
print("done") -- 8
The output using Lua 5.3:
return nil
line 7
call nil
GC
return nil
line 8
call nil
call nil
return nil
Done
return nil
return nil
return nil
"GC" is printed, but no line event is generated. I get the same result
with Lua 5.2. Is this by design?
Paul.