void *ptr problem

Started by
1 comment, last by Zervoxe 10 years, 8 months ago

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?

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

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

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. :)

This topic is closed to new replies.

Advertisement