lua-users home
lua-l archive

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


Suppose I have an object that is allocated (created) in Delphi (or C++ ro whatever). I don't (can't) want to give Lua full control on the object's life, I just want to give access to its properties via properly set callback functions in metatable of a heavy user data, that I wrap this object into for Lua.
Now the object gets destroyed (in Delphi), that brings the possibility of calling property access function with a pointer to already freed object if I have some heavydata references to this object left in Lua.
Any ideas if I can somehow avoid this? Ideally would be me being able to track down all userdata that points to this object and nil them out in Lua, but I can't think of the way how to make it automatically, without thorough keeping track of references by hand. Or maybe I can do it some other way around?