Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

void *ptr problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Zervoxe   Members   -  Reputation: 497

Like
0Likes
Like

Posted 26 July 2013 - 09:59 AM

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?



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3293

Like
0Likes
Like

Posted 26 July 2013 - 04:01 PM

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);

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Zervoxe   Members   -  Reputation: 497

Like
0Likes
Like

Posted 27 July 2013 - 07:32 AM

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, 27 July 2013 - 07:38 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS