| Newsgroups |
gmane.comp.lang.lua.bind.user |
| Message-ID |
<[email protected]> |
Hello!
I've just downloaded the latest version of luabind (0.8.1).
I have compiled on Windows32 with mingw.
Then I would like to use class_info (for the moment in Lua) in order to retrieve mainly
methods of a class, but currently I can get correctly class name and attributes while I have an
empty table for methods.
I'm currently using lua, so, after binding my C++ classes, I have add :
luabind::bind_class_info(L);
then in Lua I create a Vector3 object (bind from Ogre):
v = Vector3(0,0,0)
info = class_info(v)
info.name is "Vector3" (correct)
while typing
nm = table.getn(info.methods)
na = table.getn(info.attributes)
I have nm = 0 (wrong) and na = 3 (which is correct)
The binding in C++ is:
// OGRE::VECTOR3
luabind::module(luaState) [
luabind::class_<Vector3>( "Vector3" )
.def_readwrite( "x", &Ogre::Vector3::x )
.def_readwrite( "y", &Ogre::Vector3::y )
.def_readwrite( "z", &Ogre::Vector3::z )
.def(constructor<>())
.def(constructor<Vector3&>())
.def(constructor<Real, Real, Real>())
.def("absDotProduct", &Vector3::absDotProduct)
.def("crossProduct", &Vector3::crossProduct )
.def("directionEquals", &Vector3::directionEquals )
.def("distance", &Vector3::distance )
.def("dotProduct", &Vector3::dotProduct )
.def("getRotationTo", &Vector3::getRotationTo )
.def("isZeroLength", &Vector3::isZeroLength )
.def("length", &Vector3::length )
.def("makeCeil", &Vector3::makeCeil )
.def("makeFloor", &Vector3::makeFloor )
.def("midPoint", &Vector3::midPoint )
.def("normalise", &Vector3::normalise )
.def("normalisedCopy", (Vector3 (Vector3::*)())&Vector3::normalisedCopy )
.def("perpendicular", &Vector3::perpendicular )
.def("positionCloses", &Vector3::positionCloses )
.def("positionEquals", &Vector3::positionEquals )
.def("randomDeviant", &Vector3::randomDeviant )
.def("reflect", &Vector3::reflect )
.def("squaredDistance", &Vector3::squaredDistance )
.def("squaredLength", &Vector3::squaredLength )
.def(self + other<Vector3>() )
.def(self - other<Vector3>() )
.def(self * other<Vector3>() )
.def(self * Real() )
.def(self * Quaternion() )
.def(self * Matrix4() )
.def(tostring(self))
];
luabind::object g = globals(luaState);
luabind::object vector = g["Vector3"];
vector["ZERO"] = Vector3::ZERO;
vector["UNIT_X"] = Vector3::UNIT_X;
vector["UNIT_Y"] = Vector3::UNIT_Y;
vector["UNIT_Z"] = Vector3::UNIT_Z;
Any suggestion ?
Previously I'm using luabind-0.7 probably I have to change something in order to make it
works in the new version ?
Best,
Angelo
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry