[luabind] No overload of 'class:method' matched the arguments (), candidates are: class:method()
Brought to you by:
arvidn,
daniel_wallin
From: Alexander G. <agl...@gm...> - 2005-01-28 11:53:54
|
Hi, all! I'm using luabind CVS version from January 4th, 2005 with Lua 5.0.2. I have some number of classes I want to be able to derive from in lua code. Most of derived lua classes would need to use some additional c++ functionality, it is not needed in c++ base classes. I have following code: == [ C++ ] == class real_class { public: virtual void base_foo() { printf("base_foo\n"); } }; class my_mixin : public luabind::wrap_base { public: std::string mixin_foo() { return "[foo is called]"; } }; class my_wrapper : public real_class , public my_mixin { public: virtual void base_foo() { call<void>("base_foo"); } static void default_base_foo(real_class * ptr) { return ptr->real_class::base_foo(); } }; void register_stuff(lua_State * pState) { using namespace luabind; luabind::module(pState) [ class_ < real_class, my_wrapper >("real_class") .def(constructor<>()) .def("base_foo", &real_class::base_foo, &my_wrapper::base_foo) .def("mixin_foo", &my_mixin::mixin_foo) ]; } // Here goes lua and luabind initialization and call to register_stuff(). Then lua script // is loaded and executed. == [ LUA script ] == class 'real_derived' (real_class) function real_derived:__init() super() self.name = self.mixin_foo() end function real_derived:get_name() end rd = real_derived() When this code is executed, the following error message is displayed: no overload of 'real_class:mixin_foo' matched the arguments () candidates are: real_class:mixin_foo() Where am I wrong? I can provide more details if needed. Thank you in advance, Alexander. |