structNew

Creates a structure.

structNew([structType]) → returns Struct

Argument Reference for the structNew function

structType

Required: No
CF 2016+ If set to ordered the order in which elements are added to the structure will be maintained. Values:
  • ordered

Examples sample code invoking the structNew function


New struct using literal notation

Creates an unordered struct.

unordered = { a=1, c=3, b=2 };
writeDump( unordered );

New struct using function

Creates an unordered struct.

unordered = structNew();
unordered.a = 1;
unordered.b = 2;
unordered.c = 3;
writeDump( unordered );

New ordered struct using literal notation

CF 2016+ Creates an ordered struct. Note the square brackets.

ordered = [ a=1, b=2, c=3 ];
writeDump( ordered );

New ordered struct using function

CF 2016+ Creates an ordered struct.

ordered = structNew( "ordered" );
ordered.a = 1;
ordered.b = 2;
ordered.c = 3;
writeDump( ordered );

Fork me on GitHub