Advertisement

No type id for enum values?

Started by December 26, 2012 04:56 PM
2 comments, last by WitchLord 11 years, 11 months ago

I'm writing a function that takes a var arg type and then identifies the type to print either the value or information about the object. Everything seems to have an Id except enum values, however they always seem to get an id of 14. Can enum values be given a typeId like the rest? Or am I missing something that allows me to identify enum values?

Thanks,

Dave Krusu

Each enum type will get their own type id.

You can identify a type id as being an enum like this:
bool isEnumType = false;
if( typeId > asTYPEID_DOUBLE && (typeId & asTYPEID_MASK_OBJECT) == 0 ) )
  isEnumType = true;


You may want to take a look at the debugger add-on. Especially the method 'string CDebugger::ToString(void *value, asUINT typeId, bool expandMembers, asIScriptEngine *engine)'. It shows how to identify different types and creating a human readable string about the value/type.

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

Okay, thanks. Is there a way to get the name of the enum (not the value but the actual enum type)?

You'll want to use asIScriptEngine::GetTypeDeclaration() for that.

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