|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
exception fro property and tostringHi gurus,
Hope you can find a spare time for my troubles... I love lua and luabind though stumbled upon them only recently. So far everything goes smooth but there are couple glitches I'd like to ask you for a help. 1) It seems luabind handles std::exception thrown from object methods (bind with .def). However when I have a property is bound like this: .property("some", &MyClass::GetSome, &MyClass::SetSome) and an std::exception is thrown from SetSome then it "successfully" unwinds to the very end of my app (please find the bt at the end of the email). Of course there's a straight solution to try/catch it around my call to lua_resume but this isn't the proper way I'd guess... 2) I've got "no match for function call 'function-name' with the parameters (parameter-types)" error from luabind in the following scenario: struct A { explicit A(int n) :n_(n) {} int n_; }; struct B { A a_; A const& get_a() const {return a_;} //this one is bound as .property("a", &B::get_a) and tried with and w/o dependency policy B(int n) : a(n) {} }; For both classes operator<<(std::ostream...) is defined and tostring(self) is bound for both classes as well. However if I use the following in lua then the last line fails: a = A(10) print("a = "..tostring(a)) -- works fine b = B(20) print("b = "..tostring(b)) -- np here either print("b.a = "..tostring(b.a)) -- no match error for no obvious reason... I'd really appreciate your help and honor your expertise if anyone can help or suggest anything... Thanks a lot in advance! -------- backtrace of throw std::out_of_range from property ----------- #0 0xff01fc54 in _lwp_kill () from /lib/libc.so.1 #1 0xfefd0c50 in raise () from /lib/libc.so.1 #2 0xfefb6d58 in abort () from /lib/libc.so.1 #3 0xff34a0ac in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:97 #4 0xff347be4 in __cxxabiv1::__terminate (handler=0xd1b0c8) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:43 #5 0xff347c34 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:53 #6 0xff347d7c in __cxa_throw (obj=<value optimized out>, tinfo=0xfeefb590, dest=0) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:77 #7 0x006c6d18 in component::check_range<eTrafficBounds> (value=@0xd1b098, low=0, high=0, description=0x0) at ../../../../mgate/cmds/components/traffic_component.cpp:73 #8 0x0025cde0 in component::Traffic::SetPktSize (this=0x8fa588, size=@0x32) at ../../../../mgate/cmds/components/traffic_component.cpp:171 #9 0x006d6ff8 in luabind::detail::set<void, component::Traffic, component::Traffic, component::range_t const&, luabind::detail::null_type> (f=<error reading variable>, obj=<value optimized out>, L=0xcbcd30, policies=<value optimized out>) at ../../../../../cots/luabind/detail/call.hpp:278 #10 0x006d711c in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<int, luabind::detail::set_caller<component::Traffic, void(component::Traffic::*)(component::range_t const&), luabind::detail::null_type>, boost::_bi::list3<boost::arg<1> (*)(), boost::arg<2> (*)(), boost::_bi::value<void(component::Traffic::*)(component::range_t const&)> > >, int, lua_State*, int>::invoke (function_obj_ptr=@0x25cdc4, a0=0x0, a1=14350064) at ../../../../../cots/luabind/detail/property.hpp:107 #11 0x00724b38 in boost::function2<int, lua_State*, int, std::allocator<boost::function_base> >::operator() () at /usr/local/gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/new:93 #12 0x002ef43c in luabind::detail::class_rep::settable () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #13 0x002ef79c in luabind::detail::class_rep::settable_dispatcher () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #14 0x002d72b0 in luaD_precall () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #15 0x002d7654 in luaD_call () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #16 0x002e0b7c in luaV_execute () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #17 0x002d6e78 in luaD_rawrunprotected () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #18 0x002d7004 in lua_resume () at ../../../../../cots/boost/boost/function/function_template.hpp:618 #19 0x002664b8 in scripting::LuaScript::Step (this=0xdaf6f0, max_ticks=0) at ../../../../mgate/cmds/scripting/script_lua.cpp:339 ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ luabind-user mailing list luabind-user@... https://lists.sourceforge.net/lists/listinfo/luabind-user |
| Free Forum Powered by Nabble | Forum Help |