lua-users home
lua-l archive

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


>>>>> "temp" == temp 213 qwe <temp213@gorodok.net> writes:

 temp> setmetatable ({}, {__gc = function() print(1) error("error")
 temp> print(2) end})

 temp> It looks like at the end, garbage collector also collects
 temp> something required by error() function first. So there is no
 temp> error message from the code above, lua 5.3.5.

"at the end"? If you mean when calling lua_close on the state, then the
error() thrown is just ignored. __gc metamethods are always called via a
pcall; in normal operation any error caught by that pcall is rethrown,
interrupting the current round of finalization calls, but while closing
the state it would be pointless to propagate the error (propagate it to
what?) so it gets ignored instead.

-- 
Andrew.