Re: Pass int64

"Valery" <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <02eb01c9de09$24864120$80aea8c0@winxpvpc>
Tom, Thanks, 

Yes, your variant works. But what should I do if my class has get method like:
__int64 getSize();

.cpp
luabind::class_<RawData, boost::shared_ptr<RawData> >("RawData" )
    .def( luabind::constructor<int>() )
    .def("getSize", &RawData::getSize) 

.lua
RawData(10):getSize()

I get "you are trying to use an unregistered type".

I tryed something like the next, but I cannot use 'type'. 
luabind::class_< __int64 > ("Int64")

Thanks,
Valery.

----- Original Message ----- 
From: Tom McCubbin 
To: [email protected] 
Sent: Tuesday, May 26, 2009 3:51 PM
Subject: Re: [luabind] Pass int64


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

------------------------------------------------------------------------------
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.