lua-users home
lua-l archive

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

On 2017-09-19 02:03 AM, Paul K wrote:
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

   local a=setmetatable({},{__gc=function()
     print("GC") -- 3
debug.sethook(function(...) print(...) end,"clr")
collectgarbage("collect") -- 7
print("done") -- 8

The output using Lua 5.3:

return    nil
line    7
call    nil
return    nil
line    8
call    nil
call    nil
return    nil
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?


This has been reported before (by me). I don't remember the replies. Seems intended, tho.

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.