mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
6c40c559e3
change how type T is gleaned from destructors and constructors in case of new syntax add a hell of a lot more examples, update and clean documentation
28 lines
417 B
C++
28 lines
417 B
C++
#define SOL_CHECK_ARGUMENTS 1
|
|
#include <sol.hpp>
|
|
|
|
struct A {
|
|
int a = 10;
|
|
virtual int call() { return 0; }
|
|
};
|
|
struct B : A {
|
|
int b = 11;
|
|
virtual int call() override { return 20; }
|
|
};
|
|
|
|
int main (int, char*[]) {
|
|
|
|
sol::state lua;
|
|
|
|
lua.new_usertype<B>( "A",
|
|
"call", &A::call
|
|
);
|
|
|
|
lua.new_usertype<B>( "B",
|
|
"call", &B::call,
|
|
sol::base_classes, sol::bases<A>()
|
|
);
|
|
|
|
return 0;
|
|
}
|