title: Why can't gotos in Lua jump out of functions?
body: <p>From the Programming In Lua book 3rd edition page 38</p>
  
  <blockquote>
    <p><strong>Exercise 4.5:</strong> Can you explain why Lua has the restriction that a <code>goto</code> cannot jump out of a function? (Hint: how would you implement that feature?)</p>
  </blockquote>
  
  <p>I have a few guesses as to why it may be so:</p>
  
  <ul>
  <li>If you jump from one function into another and the second one returns, where does the PC go?</li>
  <li>If you have <code>a = f()</code> but f does a <code>goto</code> to after that line of code, what is the value of <code>a</code>?</li>
  <li>Is it not possible to define a standard behaviour because of different platforms' calling conventions?</li>
  </ul>
  
  <p>I wonder how the author would answer that question. Maybe I'll e-mail him.</p>
  
  <p>In the meantime, does anybody else have some ideas?</p>