Skip to main content
GameDev.net gamedev.net
🔒 Locked

No type id for enum values?

Started by dkrusu Dec 26, 2012 at 4:56 PM 2 replies 1.9k views
Original Post
dkrusu
dkrusu

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

WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
dkrusu
dkrusu

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

WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.