title: Popping the first element off an array in Lua
body: <p>I have an array <code>x</code> in Lua. I would like to set <code>head = x[1]</code> and <code>rest =</code> the rest of the array, so that <code>rest[1] = x[2]</code>, <code>rest[2] = x[3]</code>, etc.</p>
  
  <p>How can I do this?</p>
  
  <p>(note: I don't care if the original array gets mutated. In Javascript I would do <code>head = x.shift()</code> and <code>x</code> would contain the remaining elements.)</p>