title: Sort Arrays in Array in Lua
body: <p>Hi i am quite new to lua and i need to sort an Array in Lua.</p>
  
  <p>So i have following code</p>
  
  <pre><code>local distances = {2,3,1}
  table.sort(distances)
  </code></pre>
  
  <p>now i get </p>
  
  <ul>
  <li>distances[1] -> 1</li>
  <li>distances[2] -> 2</li>
  <li>distances[3] -> 3</li>
  </ul>
  
  <p>now i need to save some information for my "distances" aswell 
   something like the following</p>
  
  <pre><code>local distances = {{C1,2},{C2,3},{C3,1}}
  </code></pre>
  
  <p>now it is impossible to call the sort-function, but i need them sorted. 
  Is it possible to reach this?</p>
  
  <ul>
  <li>distances[1] -> {C3,1}</li>
  <li>distances[2] -> {C2,2}</li>
  <li>distances[3] -> {C1,3}</li>
  </ul>
  
  <p>Thanks guys :)</p>