• Advertisement
Sign in to follow this  

void *ptr problem

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

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
Advertisement

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

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
Sign in to follow this  

  • Advertisement