Structs

From CEW

Jump to: navigation, search

Contents

StructNew()

[edit] type

The type attribute allows you to specify what type of Struct to create.

StructNew("normal") - an ordinary structure
StructNew("linked") - the order of the keys is guaranteed.
StructNew("weak") - the content of the Struct is not guaranteed, and may be removed by the Garbage Collector.

Supported by: Image:Railo.png


[edit] case-sensitivity

BlueDragon supports an optional case-sensitivity argument to the StructNew function.

If set to true, struct keys will have their case preserved and must be referred to correctly.

Supported by: Image:BlueDragon.png


[edit] Inline Struct

Inline structs allow you to create a struct in a more convenient fashion.

Railo has supported the Struct(A:1,B:2,C:3) notation from version 1.
Adobe added [A:1,B:2,C:3] notation to ColdFusion 8, with several restrictions.

Supported by: Image:Railo.png Image:ColdFusion-8.png


[edit] Nested Inline Struct

With Railo, Struct() is a function and thus can be nested:

Struct( X:Struct(A:1,B:2,C:3) , Y:Struct(D:4,E:5,F:6) , Z:Struct(G:7,H:8,I:9) )

The CF8 notation did not initially support nesting. With CF8.0.1 it is now possible to nest inline structs:

[ X:[A:1,B:2,C:3] , Y:[D:4,E:5,F:6] , Z:[G:7,H:8,I:9] }</cde>

Supported by: Image:Railo.png Image:ColdFusion-8.0.1.png

Personal tools