Jump to content
  • Advertisement
Sign in to follow this  

Unity Javascript as script engine with classes, interfaces, … its possible?

This topic is 2834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all sorry for my English, it's not very good.

I am currently implementing an interactive 3d engine, and I want to add a script engine. After a hard search on the net, I decide to go with javascript (there exist several opensource engines like Google V8, spidermonkey...)
I also check ECMAscript versions and I see that v4 adds Classes, interfices, ... and some interesting features that I want, the problem is that v4 will never be implemented.

I aslo check that Unity uses this features but it seams that they implemented it.

I do some test with Chrome (because I'm interested in V8) but when I do something like:

class Foo
function test() {...}

It throws an error. "Unexpected reserved word". The same hapens with Firefox (spidermonkey).

My question is: Is there some javascript engine that implements this features (classes, static typed, interfices, inheritance, ...) to be embeded on a c++ aplication?

It has to had non comercial licence and writen in c or c++, and ofcorse fast...

ECMAScript v5 seems that didn't specificate this kind of things.

Maybe with Mono?

Thanks a lot.

Share this post

Link to post
Share on other sites
JavaScript doesn't have 'classes' in the C++ sense of the word. You can emulate some of the features of C++ classes using constructor functions and prototype inheritance, but you will never achieve a 1-to-1 mapping of functionality - the concepts behind the two object systems operate in fundamentally different directions.

Perhaps you should be looking at a scripting language that is more oriented towards C++ concepts (for example, AngelScript is a decent choice)?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!