Sign in to follow this  
Zervoxe

void *ptr problem

Recommended Posts

Zervoxe    1263

So I hit another problem which I couldn't find in the documentation.

I was wondering how would I expose something like

 

void Object::init(void* agent)

from C++ to Angelscript?

Share this post


Link to post
Share on other sites
WitchLord    4678

Do you really want to expose 'void*' to the scripts, despite the fact that you'll have no control of what is actually passed into this function?

 

If you really want it you can do so by registering it as a value type, like this:

 

// Register void* as a value type
engine->RegisterObjectType("void_ptr", sizeof(void*), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_PRIMITIVE);
 
// Register the method using the registered value type for void*
engine->RegisterObjectMethod("Object", "void init(void_ptr)", asMETHOD(Object, init), asCALL_THISCALL);

Share this post


Link to post
Share on other sites
Zervoxe    1263

Well, the funcion is only to be run inside C++, I just need it for registering some behaviour nodes through script, unless anyone has done an implementation of libbehaviour(behaviour tree) with exposed modules to Angelscript I would be very interested in seeing their approach to it. : )

 

I am just learning Angelscript so any advice on exposing it the best way would be very appreciated. :)

Edited by Zervoxe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this