title: Are setupvalue and upvaluejoin interchangeable (lua debug library)?
body: <p>Specifically, is there any difference (aside from the fact that setupvalue returns a name) between:</p>
  
  <pre><code>debug.setupvalue(f, up, val)
  </code></pre>
  
  <p>And</p>
  
  <pre><code>debug.upvaluejoin(f, up, function() return val end, 1)
  </code></pre>
  
  <p>(with val local)</p>
  
  <p>Or between:</p>
  
  <pre><code>debug.upvaluejoin(f1, n1, f2, n2)
  </code></pre>
  
  <p>And</p>
  
  <pre><code>debug.setupvalue(f1, n1, select(2, debug.getupvalue(f2, n2)))
  </code></pre>
  
  <p>I was under the impression that upvaluejoin added some magic, but some testings suggest otherwise. </p>
  
  <p>Is upvaluejoin just some sugar to ease function duplication and such?</p>