lua-users home
lua-l archive

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

> I know that it is not safe to change the __mode value of a metatable,
> however, I wonder if it is ok to unset the metatable - or is that
> unsafe too? (the documentation here says
> "After you use a table as a metatable, you should not change the
> value of its field __mode. Otherwise, the weak behavior of the tables
> controlled by this metatable is undefined."
> So I think setting the metatable to nil of a weaktable should be a
> valid operation)

It is not; I am afraid the documentation is misleading here. If you
change the status of a weak table back to non weak (no matter how),
it may take some time for the behavior to change.

-- Roberto