title: Is there a way to make a function return a function?
body: <p>So in Lua you can do something like this</p>
  
  <pre class="lang-lua prettyprint-override"><code>local function start(n)
      return function()
          n = n + 1;
          return n;
      end;
  end
  
  print(start(1)()); --&gt; 2
  </code></pre>
  
  <p>I've heard of templates though I don't want to have an xy problem, or is there another way</p>