Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

Instantiating script class from method of another class?

$
0
0

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 …


Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>