If It Looks Like a Structure – It Might Not Be One

A ColdFusion variable named user.login is a structure named user containing a member named login. Right? Well, maybe – it depends on how the variable was created. It might indeed be a structure (created using the StructNew() function) with a member with in, or it may be a variable named “user.login”. And if it is the latter, using any of the struct functions will throw an error. So how can you be sure that what looks like a structure actually is a structure? Use the IsStruct() function. (Applies to: ColdFusion All)

Leave a Reply