lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


hi
ive got a problem with luabind and boost::shared_ptr

//cpp
struct A
{
	void test()
	{
		printf("A::test");
	};
};

struct B
{
	B() : a(new A) { }

	boost::shared_ptr<A> a;
};

//luabind
luabind::module(L)
[
	luabind::class_<A>("A")
		.def("test", &A::test),
	luabind::class_<B>("B")
		.def_readwrite("a", &B::a)
];

//lua, provided and object of B, called b is registerd in lua's global table:
b.a:test()


i know _why_ this doesnt work (luabind tries to find the test method in boost::shared_ptr, which isn't even exposed to lua)
but how do i solve it?

oh and i also tried defining luabind::get_pointer and get_const_holder, just like they do in the luabind documentation, but it didn't change anything.

/chot

_________________________________________________________________
Hitta rätt på nätet med MSN Sök http://search.msn.se/