title: Lua table with string keys does not work with number indexing?
body: <p>I'm a beginner in Lua.</p>
  
  <p>I thought pushing values to a table using string keys would automatically also do number indexing but I think I was wrong about this.</p>
  
  <p><strong>My Code :</strong></p>
  
  <pre><code>local t = {}
  t.name = "John"
  t.age = 30
  print("Name : " .. t.name .. "\nAge : " .. t.age)
  </code></pre>
  
  <p>While this code works fine and prints the expected result,</p>
  
  <pre><code>Name : John
  Age : 30
  </code></pre>
  
  <p>If I try to print the result this way,</p>
  
  <pre><code>print("Name : " .. t[1] .. "\nAge : " .. t[2])
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>lua: main.lua:5: attempt to concatenate a nil value (field '?')
  stack traceback:
      main.lua:5: in main chunk
      [C]: in ?
  </code></pre>
  
  <p>Does this mean I cannot iterate through the table using <code>for</code> with number indexing without having to know the key strings?</p>
  
  <p>If so, is there any work around to make the both way work?</p>