title: Remove self in lua
body: <p>I'm currently developing a game in Love2D and using an OOP library known as middleclass. Unfortunately, middleclass does not by default have destructors i.e something which allows me to destroy an object. I store all my objects in a table so I can loop through them and execute their Draw and Update functions. In my code I want the object to be able to remove itself. I have tried</p>
  
  <pre><code>self = nil
  </code></pre>
  
  <p>but this does not work! Would it be possible to find out the objects key in the table without looping through it to find it and then just use table.remove? This is still suboptimal as if there were references in the future i would have to remove it from those tables as well. 
  How can this be achieved?</p>