Sign in to follow this  

No type id for enum values?

This topic is 1848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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. Edited by Andreas Jonsson

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this