Hi, This might be a silly newbie question, but how can I in script instatiate a class by calling a method from another class? Say in script I'd like to do something like this:
Foo a;
Bar b = a.getNewBar();
In C++, I'd have something like this:
class Bar {
Bar();
void Addref();
void ReleaseRef();
};
class Foo {
Foo();
void Addref();
void ReleaseRef();
Bar* getNewBar() {return new Bar();}
};
I've tried to find a suitable function registration to do that, but I'm not getting anything working. I'm assuming that class Bar should be without factory, is that correct? (There is no need to create plain Bar object)
I was also wondering if getNewBar() should return asIScriptObject*, but what then I should do with the factory, as described in the docs?
There is a valid reason for this structure, in the actual use case there are 3 levels of hierarchy coming from external API this way, and I'd like to expose this API to the script as nicely as possible.