title: Lua: How to look up in a table where the keys are tables (or objects)
body: <p>I want to store a lua table where the keys are other lua tables.  I know that this is possible BUT I want to be able to do look ups in the table using copies of those tables. Specifically, I want to be able to do:</p>
  
  <pre><code>t = {}
  key = { a = "a" }
  t[key] = 4
  key2 = { a = "a" }
  </code></pre>
  
  <p>and then I want to be able to look up:</p>
  
  <pre><code>t[key2]
  </code></pre>
  
  <p>and get 4.</p>
  
  <p>I know that I can turn <code>key</code> into a string and put it into table <code>t</code>. I've also thought about writing a custom hash function or doing this by nesting tables. Is there a best way for me to get this type of functionality? What other options do I have?</p>