🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
How to use typedef (user type ) in angelscript ?
Hello. I think this is what you need:
and here is an example:
Here is the link to the Object types (the last parameter):
http://www.angelcode.com/angelscript/sdk/docs/manual/pages/ref_objecttypes.html#primitive
RegisterObjectType(const char *name, int byteSize, asDWORD flags);
and here is an example:
engine->RegisterObjectType("DWORD", sizeof (DWORD), asOBJ_APP_PRIMITIVE);
Here is the link to the Object types (the last parameter):
http://www.angelcode.com/angelscript/sdk/docs/manual/pages/ref_objecttypes.html#primitive
If you wanted to register it as an object type you would have to register it as:
You would also have to register the proper behaviours to allow the scripts to use this type as the other primitive types, i.e. all math operators, comparison operators, and cast operators.
However, in the WIP version that you can download from the SVN, there is a much easier way to register it:
The RegisterTypedef feature (and most of the others) that are added to the WIP, are contributions from Digital_Asphyxia.
Regards,
Andreas
engine->RegisterObjectType("DWORD", sizeof(DWORD), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_PRIMITIVE);
You would also have to register the proper behaviours to allow the scripts to use this type as the other primitive types, i.e. all math operators, comparison operators, and cast operators.
However, in the WIP version that you can download from the SVN, there is a much easier way to register it:
engine->RegisterTypedef("DWORD", "uint32");
The RegisterTypedef feature (and most of the others) that are added to the WIP, are contributions from Digital_Asphyxia.
Regards,
Andreas
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement