   Dissecting TypeId
  I'm working on determining a Script Object's Property's application side type from it's typeId so I know what to cast it to. (I'm serializing them to a stream)So just to be clear, a typeId for a given thing in a script is composed of it's actual type, and it's storage method (handle, script object, ect...) all found in: asETypeIdFlags right?Do custom types just begin getting numbered after the last type in that enum?Quote:asTYPEID_DOUBLE = 11So my first custom type would be 12?Are application side registered typeId's handled the same way?   
  Avoid making any assumptions on the value of the type id. Only the type id of the primitive types can be assumed to be fixed.An application registered type has the bit asTYPEID_APPOBJECT set. A script class has the bit asTYPEID_SCRIPTOBJECT set.   ;  ok, so for primitives I can use that enum with the typeId, but for custom types I should compare type names?[Edited by - Wavesonics on May 26, 2009 7:10:50 PM];  No, you don't have to use name comparisons to determine the type. You can use the type id, I just meant that you shouldn't make any assumptions on the exact value. Use GetTypeIdByDecl() to determine the type id for a known type, and then compare with that rather than a hard coded type id.;Quote:Original post by WitchLordAn application registered type has the bit asTYPEID_APPOBJECT set. A script class has the bit asTYPEID_SCRIPTOBJECT set.It's actually kind of confusing. asTYPEID_SCRIPTOBJECT isn't a single bit, it's constant is 0x0C000000, which is the bits for 0x08000000 and 0x04000000, and asTYPEID_APPOBJECT is 0x04000000, which overlaps with the bits with asTYPEID_SCRIPTOBJECT. So if you want to check if a type ID is a application registered type you need to use: if ((type_id & asTYPEID_SCRIPTOBJECT) == asTYPEID_APPOBJECT) rather than just if (type_id & asTYPEID_APPOBJECT).   ;  yep, just realized this and was coming back here to comment on it :PThanks though SiCrane!   ;Quote:Original post by SiCraneIt's actually kind of confusing. asTYPEID_SCRIPTOBJECT isn't a single bit, it's constant is 0x0C000000, which is the bits for 0x08000000 and 0x04000000, and asTYPEID_APPOBJECT is 0x04000000, which overlaps with the bits with asTYPEID_SCRIPTOBJECT. So if you want to check if a type ID is a application registered type you need to use: if ((type_id & asTYPEID_SCRIPTOBJECT) == asTYPEID_APPOBJECT) rather than just if (type_id & asTYPEID_APPOBJECT).That is actually a mistake. The asTYPEID_SCRIPTOBJECT constant should have the value 0x08000000. I've fixed this in the SVN now. Thanks.   