title: SWIG:Lua - Passing a c++ instance as a lua function parameter
body: <p>I'm exporting some c++ classes to Lua with SWIG. I have declared boost::filesystem::path in the SWIG interface file like this:</p>
  
  <pre><code>namespace boost
  {
      namespace filesystem
      {
          class path {};
      }
  }
  </code></pre>
  
  <p>Now I want to call a function declared in a lua script which should take a boost::filesystem::path&amp; as parameter to pass it to another object. I only need to be able to pass the path to the object. I don't need to use any functionality from the path object.</p>
  
  <pre><code>function on_path_selected(the_path)
      another_object:set_path(the_path)
  end
  </code></pre>
  
  <p>I am going to call the Lua function from c++ using it's index.</p>
  
  <pre><code>lua_rawgeti(L, LUA_REGISTRYINDEX, m_function_index);
  lua_push[SOMETHING](L, path_object); // &lt;-- HOW TO ?
  lua_pcall(L,1,0,0)
  </code></pre>
  
  <p>THE QUESTION: How to push a boost::filesystem::path as a parameter to the Lua function?</p>