Advertisement

enumerating methods on objects

Started by September 08, 2008 08:19 AM
2 comments, last by WitchLord 16 years, 2 months ago
Hi Andreas, I'm constantly amazed at how well angelscript has worked in our application, and that you continue to keep adding new features, so congrats! I've been hanging out for the ability to enumerate object type methods in angelscript, so I'm impressed that its made it in since Version 2.13.0. I may be using the method enumeration interface all wrong, but it seems that the enumeration can only happen after calling build on the engine. I was kind of expecting it to be available immediately after registration of the object type and methods. Can you confirm that this is the case? Thanks pratty
For registered types it shouldn't be necessary to build any scripts first. Can you tell me what you're doing to obtain the asIObjectType pointer when it doesn't work?

Regards,
Andreas

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

Advertisement
I'm calling RegisterObjectType first, which writes to the ScriptEngine's objectTypes member.

then RegisterObjectMethod, which writes to the ScriptEngine's objectTypes->methods.

and finally, GetObjectTypeCount, which oddly looks up the ScriptEngine's classTypes member, which is empty at this point and remains empty until Build is called on the ScriptEngine.

My first impression was that the type and method registration use a different storage than the reflection/introspection mechanism (i.e. objectTypes vs classTypes), but maybe I'm just using it the wrong way.

Regards,
Pratty
Indeed, the GetObjectTypeCount() method doesn't return the registered types. Infact it doesn't even return the registered types after Build() has been called.

I will however change this. You should be able to enumerate registered types as well as script declared types in a future version.

For now, you can retrieve the object type interface for registered types if you know the type name with the following calls:

int typeId = engine->GetTypeIdByDecl("MyObject");asIObjectType *objType = engine->GetObjectTypeById(typeId);


Regards,
Andreas

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