Quantcast

default_converter and luabind assignment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

default_converter and luabind assignment

Arun.Ramasamy

Hi,

I want to add support to a user type in luabind, so that I can assign c++ variables of the type to lua variables like so:

 

struct UserType{..};

 

//and then do

 

UserType u;

luabind::globals(L)[“UserTypeList”][“a”] = u; //equivalent to saying UserTypeList.a = u  in Lua.

 

 

I registered the class type via luabind::class_ and specialized the default_converter for the type :

 

module(L)[ class_< UserType>(“_ UserType”)];

 

namespace luabind{

     template<>

struct  default_converter< UserType> : native_converter_base< UserType> {

     //define compute_score, to and from functions.

};

}

 

 

But when I actually do the assignment, the converter code doesn’t get called. I’m expecting the ‘to’ function in the converter to get called, since I’m assigning a custom  type to a lua object, which doesn’t happen.

Is this the correct way to do this. Please let me know if you find any issues with this setup.

 

Thanks arun.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Loading...