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,
______________ 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;
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,
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*[]) {
}