Re: Pass int64

Tom McCubbin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1243342266.22852.5.camel@macquad>
If the constructor is not explicit (not marked as so below), why not try
and change your luabind::constructor<>()  to take an int, and let the
compiler do its 1 allowed conversion step.  At runtime luabind doesn't
have the smarts to map a number to __int64 in looking up the constructor
would be my guess as to why you have the problem.

luabind::class_<RawData, boost::shared_ptr<RawData> >("RawData" )
    .def( luabind::constructor<int>() ); //...

That or derive and add a new signature for int.


On Tue, 2009-05-26 at 14:32 +0300, Valery wrote:

> Hello,
> 
> I have a class that gets __int64 as a parameter in the constructor. I am 
> trying to create it from lua, but get the error "FAIL: Test: no constructor 
> of 'RawData' matched the arguments (number)
>  candidates are:
> RawData(custom [__int64])"
> 
> Could anybody help?
> 
> .cpp
> class RawData {
>  public: RawData(__int64) {}
> };
> luabind::class_<RawData, boost::shared_ptr<RawData> >("RawData")
>  .def(luabind::constructor<__int64>())
> 
> .lua
> x=RawData(10)
> 
> Thanks,
> Valery. 
> 
> 
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.