title: How to pass a function to another function in Lua?
body: <p>I am a beginner of Lua and I want to config <code>init.lua</code> for my nvim. I am trying to pass a function(from <code>init.lua</code>) to another function as argument (to <code>nerdTree.lua</code>), and invoke it in <code>nerdTree.lua</code></p>
  <p>I think this should work but I got an error:</p>
  <pre><code>/.config/nvim/init.lua:26: attempt to call a boolean value
  </code></pre>
  <p>Why is that? What have I done wrong?</p>
  <p>My <code>init.lua</code></p>
  <pre class="lang-lua prettyprint-override"><code>local function load_plugins()
    local use = require('packer').use
    require(&quot;packer&quot;).startup(
      {
        function()
          use 'wbthomason/packer.nvim'
          use &quot;neovim/nvim-lspconfig&quot;
                  use 'glepnir/lspsaga.nvim'
          use &quot;nvim-lua/completion-nvim&quot;
          use &quot;nvim-treesitter/nvim-treesitter&quot;
          use &quot;joshdick/onedark.vim&quot;
          use &quot;itchyny/lightline.vim&quot;
          use &quot;ryanoasis/vim-devicons&quot;
          require('nerdTree')(use) //Point of interest
        end,
        config = {package_root = '/tmp/nvim/site/pack'}
      }
    )
  end
  </code></pre>
  <p>My <code>nerdTree.lua</code></p>
  <pre class="lang-lua prettyprint-override"><code>function load(use)
      use &quot;preservim/nerdtree&quot;
  end
  </code></pre>