Advertisement Jump to content
Sign in to follow this  

mixed C++/Script class

This topic is 1816 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



Is there a way to easily add scripted methods to classes that are registered on the C++ class? Typically I would need to define a script class in C++, which has some method implementations written in angelscript (not C++). Something like:

int r = engine->RegisterObjectType("MyClass", 0, asOBJ_REF|asOBJ_NOCOUNT); assert( r >= 0 );
r = engine->RegisterObjectMethod("MyClass", "int method()", "return this.value;"); assert( r >= 0 );

I know it is not possible to do this directly, but is there a trick to do this already?


In fact,what would be nice is to be able to compile object methods just the same way you can already compile a function using CompileFunction(). 

Share this post

Link to post
Share on other sites

I guess the wrapping solution is not a bad idea. However, it is not possible to define cast operators on the script side, is it? It seems it is reserved to application registered classes, right?

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!