lua-users home
lua-l archive

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



Thank you for useful answers!

>>> P.P.S. How to get to know that __gc metamethod has been called for
>>> this particular userdata from C code?

> A common approach is to set the pointer in your full userdata to `NULL`
> in your finalizer.

This part I just was looking for.
(to add some additional asserts in my code)

In experiments I noticed that sometimes
the __gc call happens slightly after a weak value is removed from the table
and in this gap a new value may be created.


--
Vyacheslav Napadovsky