ThePhD / sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
http://sol2.rtfd.io/
MIT License
4.12k stars 500 forks source link

Overloaded base function isn't called #1433

Open deadlocklogic opened 1 year ago

deadlocklogic commented 1 year ago
struct Test1 {
    void test() {
    }
};
struct Test2 : Test1 {
    void test(int value) {
    }
};
Test2.new():test()
Test2.new():test(2) # error stack index 2, expected number, received no value: not a numeric type that fits exactly an integer (number maybe has significant decimals) (bad argument into 'void(int)')

Is this normal, or there is a bug somewhere?

MJCollett commented 1 year ago

Perhaps you should show us how you define the Sol usertypes.

From a C++ (rather than Sol or Lua) point of view Test2::test does not actually overload Test1::test: it hides it. To get an C++ overload you need to include a using Test1::test; in the definition of Test2. This may or may not be relevant to your issue.