Add more warnings about Lua's delete()

Closes #1170
develop
lethosor 2017-12-16 16:17:11 -05:00
parent b1e77fa260
commit f59a91a0db
1 changed files with 10 additions and 4 deletions

@ -125,12 +125,18 @@ All typed objects have the following built-in features:
* ``ref:delete()`` * ``ref:delete()``
Destroys the object with the C++ ``delete`` operator. Destroys the object with the C++ ``delete`` operator. If the destructor is not
If destructor is not available, returns *false*. available, returns *false*. (This typically only occurs when trying to delete
an instance of a DF class with virtual methods whose vtable address has not
been found; it is impossible for ``delete()`` to determine the validity of
``ref``.)
.. warning:: .. warning::
the lua reference object remains as a dangling ``ref`` **must** be an object allocated with ``new``, like in C++. Calling
pointer, like a raw C++ pointer would. ``obj.field:delete()`` where ``obj`` was allocated with ``new`` will not
work. After ``delete()`` returns, ``ref`` remains as a dangling pointer,
like a raw C++ pointer would. Any accesses to ``ref`` after ``ref:delete()``
has been called are undefined behavior.
* ``ref:assign(object)`` * ``ref:assign(object)``