sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Typo in the documentation

Open OndrejPopp opened this issue 2 years ago • 0 comments

Hi, tx for making this library! I am making a C++ -> Lua bridge from a set of C++ classes I already wrote, and so I did some documentation reading, and found a typo It's over here,

https://sol2.readthedocs.io/en/latest/api/usertype.html#usertype-inheritance

in the statement,

                   ______________ over there B should be A
                 /
lua.new_usertype<B>( "A",
	"call", &A::call
    );

Ok, that was it. Tx!

Ondrej

#define SOL_ALL_SAFETIES_ON 1 #include <sol/sol.hpp>

struct A { int a = 10; virtual int call() { return 0; } virtual ~A(){} }; struct B : A { int b = 11; virtual int call() override { return 20; } };

int main (int, char*[]) {

sol::state lua;
                    ______________ over there B should be A
                  /
lua.new_usertype<B>( "A",
	"call", &A::call
);

lua.new_usertype<B>( "B",
	"call", &B::call,
	sol::base_classes, sol::bases<A>()
);

return 0;

}

OndrejPopp avatar Jul 21 '23 18:07 OndrejPopp