🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

binding methods in luabind that have floats

Started by
0 comments, last by nekoflux 20 years, 2 months ago
hey all: I'm trying to bind a function and also a constructor for one of my Classes so that its callable in lua, but Its not working. Heres my class definition:
public Class CBoundingBox{
 public:
 CBoundingBox(float param1, float param2){}

 float avg(int iparam1, float fparam2){
   return 0.5f;
 }
};
heres my module definition for CBoundingBox:
module(luaVM)
[
  class_<CBoundingBox>("CBoundingBox")
  .def(constructor<float, float>())
  .def("avg", (float(*)(int, float) &CBoundingBox::avg) 
];      
any ideas how I'm declaring it wrong? thanks y'all! -neko [edited by - nekoflux on May 1, 2004 4:05:47 PM]
nekoflux
Advertisement
Hm, this sounds too simple and I am not that experienced with luabind anyway, but why can''t you just make it .def("avg",&CBoundingBox::avg)? That''s how it is shown in the documentation, anyway.

This topic is closed to new replies.

Advertisement