Rapptz / sol

A C++11 Lua wrapper
MIT License
209 stars 32 forks source link

Template member #76

Closed PhilCK closed 8 years ago

PhilCK commented 8 years ago

Is it possible to bind a template member function?

I'm trying to bind a varient class.

I've tried

  m_lua.new_usertype<Test::Param>(
    "Param",
    "get_bool", &Test::Param::get<bool>
  );

That produces error, expecting 3 arguments

and (although I didn't have hope in this one.)

  m_lua.new_usertype<Test::Param>(
    "Param",
    "get_bool", static_cast<bool (Test::Param::*) ()>( &Test::Param::get<bool> )
  );
victorlevasseur commented 8 years ago

This should work, but you should take a look at a far newer (and maintained) version of Sol : https://github.com/ThePhD/sol2

PhilCK commented 8 years ago

oops too many tabs posted in wrong repo.