title: get the address of a lua object
body: <p>When you print certain types in lua (such as functions and tables), you get the name of the type and an address, as below:</p>
  
  <pre><code>&gt; tab = {}
  &gt; print(tab)
  table: 0xaddress
  </code></pre>
  
  <p>I have created a simple class as below, and I would like to override the <code>__tostring</code> method similarly. How do I get the address of the object that I want to print?</p>
  
  <p>Here's my class.  I would like <code>print(pair)</code> to print out <code>Pair: 0xaddress</code>. Obviously this is a trivial example, but the concept is useful:</p>
  
  <pre><code>Pair = {}
  Pair.__index = Pair
  
  function Pair.create()
   local p = {}
   setmetatable(p, Pair)
   p.x = 0
   p.y = 0
   return p
  end
  
  function Pair:getx()
   return self.x
  end
  
  function Pair:gety()
   return self.y
  end
  
  function Pair:sety(iny)
   self.y=iny   
  end
  
  function Pair:setx(inx)
   self.x=inx
  end
  </code></pre>