Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in the documentation #1514

Open
OndrejPopp opened this issue Jul 21, 2023 · 0 comments · May be fixed by #1548
Open

Typo in the documentation #1514

OndrejPopp opened this issue Jul 21, 2023 · 0 comments · May be fixed by #1548

Comments

@OndrejPopp
Copy link

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;

}

C3pa added a commit to C3pa/sol2 that referenced this issue Nov 6, 2023
C3pa added a commit to C3pa/sol2 that referenced this issue Nov 6, 2023
@C3pa C3pa linked a pull request Nov 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant