Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

No type id for enum values?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 dkrusu   Members   -  Reputation: 244

Like
0Likes
Like

Posted 26 December 2012 - 10:56 AM

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



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3445

Like
0Likes
Like

Posted 26 December 2012 - 02:40 PM

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, 26 December 2012 - 02:51 PM.

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

#3 dkrusu   Members   -  Reputation: 244

Like
0Likes
Like

Posted 26 December 2012 - 05:15 PM

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



#4 Andreas Jonsson   Moderators   -  Reputation: 3445

Like
0Likes
Like

Posted 26 December 2012 - 07:37 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS