title: How do I get the number of keys in a hash table in Lua?
body: <pre><code>myTable = {}
  myTable["foo"] = 12
  myTable["bar"] = "blah"
  print(#myTable) -- this prints 0
  </code></pre>
  
  <p>Do I actually have to iterate through the items in the table to get the number of keys?</p>
  
  <pre><code>numItems = 0
  for k,v in pairs(myTable) do
      numItems = numItems + 1
  end
  print(numItems) -- this prints 2
  </code></pre>