title: Return multiple values to a function, and access them separately in Lua?
body: <p>If I have a function that returns multiple values, how can I access those values separately? Something like table[i].</p>
  
  <pre><code>angles = function()
      x = function()
          local value = 0
          return value
      end
  
      y = function()
          local value = 90
          return value
      end
  
      z = function()
          local value = 180
          return value
      end
  
      return x(), y(), z()
  end
  </code></pre>
  
  <p>A problem arises here when wanting to use, for example, the <code>x</code> value separately, while keeping it in the function <code>angles</code>.</p>
  
  <pre><code>print(????)
  </code></pre>
  
  <p>Sort of wish functions worked like tables in this respect, so I could type something like <code>print(angles.x)</code></p>
  
  <p>Also, I know that code seems really redundant, but it's actually a much more simplified version of what I'm actually using. Sorry if it makes less sense that way.</p>