title: Lua metamethods not being called
body: <p>I'm kinda new to Lua (not really done much with it yet) and I'm trying to wrap my mind around metatables. I have had them working before but now (after a number of months) I have encountered something really weird.</p>
  
  <p>What should this script print when run?</p>
  
  <pre><code>__mt = {}
  
  __mt.__index = function(table, key)
      print("In __index")
      return 99
  end
  
  test = {}
  test.x = 5
  
  setmetatable(test, __mt)
  
  print(test.x)
  </code></pre>
  
  <p>Personally, I would expect it to print "In __index" (from the metamethod) followed by 99. However, whenever I run it I get 5. Nothing I do can get the index metamethod to run. It just acts like I'm using <code>rawget()</code> instead.</p>
  
  <p>Curiously, adding</p>
  
  <pre><code>print(getmetatable(test).__index(test, "x"))
  </code></pre>
  
  <p>will do the right thing. The metatable is there, <code>__index()</code> is correct, it just isn't being called.</p>
  
  <p>Is this a bug or am I just doing something stupid? I can't tell.</p>