Hi,
i'm trying to add angelscript to my graph viewing program; the scripts should be written by the user to interact with the graph in the program itself.
Both graph and nodes already exist in the program, and the script shouldn't be able to delete them or create new ones directly. However the graph should have a couple methods through which the script can do so.
in C++ graph.add_node() adds a node to the graph and returns a pointer to it, graph.remove_node(node*) removes the node. graph.get_first_node() returns a pointer to the first node in the list, as starting point for algorithms. node.get_neighbour(unsigned int n) returns a pointer to the nth node connected to that node.
But when i try to register any of these methods that return a pointer to a node i get errors.
engine->RegisterObjectType("graph", 0, asOBJ_REF);
engine->RegisterObjectType("node", 0, asOBJ_REF);
engine->RegisterObjectBehaviour("graph", asBEHAVE_ADDREF, "void f()", asMETHOD(graph, AddRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("graph", asBEHAVE_RELEASE, "void f()", asMETHOD(graph, ReleaseRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("node", asBEHAVE_ADDREF, "void f()", asMETHOD(graph::node, AddRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("node", asBEHAVE_RELEASE, "void f()", asMETHOD(graph::node, ReleaseRef), asCALL_THISCALL);
engine->RegisterObjectMethod("graph", "int test()", asMETHOD(graph, test), asCALL_THISCALL);
engine->RegisterObjectMethod("graph", "node* get_first_node()", asMETHOD(graph, get_first_node), asCALL_THISCALL);
engine->RegisterObjectMethod("node", "int test()", asMETHOD(graph::node, test), asCALL_THISCALL);
engine->RegisterGlobalProperty("graph g", g);
Error: Failed in call to function 'RegisterObjectMethod' with 'graph' and 'node* get_first_node()' (Code: asINVALID_DECLARATION, -10)
It does so with and without *
What am i doing wrong?