Re: [luabind] Using functors with Luabind
Brought to you by:
arvidn,
daniel_wallin
From: Daniel W. <da...@ra...> - 2007-05-18 09:57:06
|
Jason McKesson wrote: > Is it possible to register a functor with Luabind? Or, more > specifically, the contents of a boost::function<> object? So that > something like this could work: [...] > That really long statement does some functional composition (and believe > me, it's not even close to the most complex bit of C++-style functional > programming I have written), such that it returns a functor that will > take a luabind::object as a single parameter, call GetFloat to fill in > the other parameter for DoSomething, and then call DoSomething with the > float and object. > > Is it OK to give "def" something like this? No, I'm afraid not. In theory, the signature could be deduced from boost::function<>, but it isn't. Some time in the future, something like this is intended to be used to accomplish what you want: def( "..." , luabind::make_function( L, boost::bind(&DoSomething, boost::bind(&GetFloat), _1) , mpl::vector2<void, luabind::object>() ) ) But for now you need to write a thin wrapper function. -- Daniel Wallin da...@ra... http://www.rasterbar.com |