title: Lua in pairs with same order as it's written
body: <p>Is there any way to loop trough a table like the one below in the same order as it's written?</p>
  
  <pre><code>local tbl = {
      ["hello"] = 1,
      [2] = 2,
      [50] = 3,
      ["bye"] = 4,
      [200] = 5
  }
  </code></pre>
  
  <p>What I mean is that when I use "in pairs" I'll get a different order everytime I execute my code ...</p>
  
  <p>I'm searching for something like this:</p>
  
  <pre><code>function get_keys(tbl)
      local rtable = {}
      for k,v in pairs(tbl) do
          table.insert(rtable, k)
      end
      return rtable
  end
  
  local keys_of_tbl = get_keys(tbl)
  for i = 1, table.getn(keys_of_tbl) do
      --Do something with: tbl[keys_of_tbl[i]]
  end
  </code></pre>
  
  <p>But because the function "get_keys" is based on "in pairs" again, it won't work ...</p>