08-17-2017, 03:48 AM
Unfortunately it works slightly differently for structs / classes and for functions, which makes it hard.
But anyway, I'm making slow progress. The function now additionally supports decorators on the types:
The second one is used for static methods, it checks that the first param is the cRoot class (as in "cRoot:doSomething()"). I'm still working on this one, but I'm pretty sure I can do it.
The next thing I'd like to do is a detailed report when no overloads match - I want to list all the possible overloads (already done) and for each possible overload, the exact reason why it wasn't matched ("Overload (cPlayer, string): param #1: expected a cPlayer instance, got a number instead").
But anyway, I'm making slow progress. The function now additionally supports decorators on the types:
ReadParams(overloadUsed, std::tie(cLuaState::self(self), ...) ); ReadParams(overloadUsed, std::tie(cLuaState::staticSelf<cRoot>(), ...) );The first one is used for regular object methods and makes sure that the first param is non-nil (in the future I'll add a specific error message, hence "self" instead of "nonNil").
The second one is used for static methods, it checks that the first param is the cRoot class (as in "cRoot:doSomething()"). I'm still working on this one, but I'm pretty sure I can do it.
The next thing I'd like to do is a detailed report when no overloads match - I want to list all the possible overloads (already done) and for each possible overload, the exact reason why it wasn't matched ("Overload (cPlayer, string): param #1: expected a cPlayer instance, got a number instead").