protected internal void OnDestroy() { if (!_Destroyed) { _Destroyed = true; CallLuaFunc("onDestroy"); _NeighboursReady = false; _Neighbours = null; if (!object.ReferenceEquals(_Self, null)) { var l = _Self.L; if (l != IntPtr.Zero) { l.getref(_Self.Refid); // self l.getfenv(-1); // self ex l.ClearTable(-1); l.pop(2); } _Self.Dispose(); _Self = null; } if (_DestroyRegIndex > 0) { RemoveDestroyRegIndex(_DestroyRegIndex); _DestroyRegIndex = 0; } ClearExVal(); CheckDestroyed(); } }
protected internal void OnDestroy() { if (!_Destroyed) { _Destroyed = true; CallLuaFunc("onDestroy"); if (!object.ReferenceEquals(_Self, null)) { _Self.Dispose(); _Self = null; } if (_DestroyRegIndex > 0) { RemoveDestroyRegIndex(_DestroyRegIndex); _DestroyRegIndex = 0; } if (ExFields != null) { ExFields.Clear(); } CheckDestroyed(); } }