title: In Lua, is there a difference between local functions declared with and without the "local" keyword?
body: <p>Preface: As far as I can see, the docs on the website don't really speak to this, and I haven't found anyone else even <em>asking</em> the question, so I'm pretty sure these two forms are identical, but I want know if anyone knows <em>for certain</em>.</p>
  
  <p>Given this Lua code:</p>
  
  <pre><code>function f()
      function a() ... end
      local function b() ... end
      ...
  end
  </code></pre>
  
  <p>Is there any functional difference between <code>a()</code> and <code>b()</code>? I'm speaking in terms of performance, access, caveats, anything at all. Like, in the end, do they both have exactly the same underlying representation at runtime?</p>
  
  <p>I suspect there isn't any difference, but I'm not <em>sure</em>, and that bugs me. I know <code>a()</code> is <em>scoped</em> to the enclosing function <code>f()</code>, but I'm not sure if that truly makes it a local variable in terms of how things function under the hood. With <code>b()</code>, I can be certain.</p>
  
  <p>We know from the official docs that my definition of <code>b()</code> above is syntactic sugar for this:</p>
  
  <pre><code>    local b
      b = function() ... end
  </code></pre>
  
  <p>I'm tempted to believe that, even without the <code>local</code> keyword in <em>my</em> definition, the final, de-sugared definition of <code>a()</code> would also follow exactly that format, including the <code>local a</code> part.</p>
  
  <p>I just feel like I can't <em>assume</em> this.</p>