Pointer to class parent.
Sorry about this question,
but im trying to put a pointer to parent on a AS class definition and i cant do it, i get ' Property (1, 8) : Error : Expected identifier ' error, someone can explain how to do that?.
/// C++ //////
class cClass{
cClass* m_pParent;
};
...
as->RegisterObjectType("cClass", sizeof(cClass), asOBJ_CLASS_CD);
as->RegisterObjectProperty("cClass", "cClass& Parent", offsetof(cClass, m_pParent) );
Thanks,
Gunder.
Here's an example:
class CObj{public: CObj() {refCount = 1; parent = 0;} ~CObj() {} CObj &operator=(CObj &other) { parent = other.parent; return *this; }; void AddRef() {refCount++;} void Release() {if( --refCount == 0 ) delete this;} int refCount; CObj *parent;}; r = engine->RegisterObjectType("obj", sizeof(CObj), asOBJ_CLASS_CDA); assert( r>=0 ); r = engine->RegisterObjectBehaviour("obj", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(CObj_Construct), asCALL_CDECL_OBJLAST); assert( r>=0 ); r = engine->RegisterObjectBehaviour("obj", asBEHAVE_ADDREF, "void f()", asMETHOD(CObj,AddRef), asCALL_THISCALL); assert( r>=0 ); r = engine->RegisterObjectBehaviour("obj", asBEHAVE_RELEASE, "void f()", asMETHOD(CObj,Release), asCALL_THISCALL); assert( r>=0 ); r = engine->RegisterObjectBehaviour("obj", asBEHAVE_ASSIGNMENT, "obj &f(const obj &in)", asMETHOD(CObj,operator=), asCALL_THISCALL); assert( r>=0 ); r = engine->RegisterObjectProperty("obj", "obj@ parent", offsetof(CObj,parent)); assert( r>=0 );
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement