The equivalent of the "new" keyword that is found in many programing languages is the function
crx_new() / crxOop.crx_new(). The function works the same way as it does for classes, and has the same
exact signature. It is the only way to create structure instances, and provides four overrides
which allow the creation of single or multiple instances. All four overrides allow the use of
anonymous structure definitions,
a feature which can be abused very easily.
crx_new(structureDefinitionOrStructureName, [parameter01, parameter02, ...])
structureDefinitionOrStructureName
Class Definition or String
The structure Definition (object) or name (string)
[parameter01, parameter02, ...]
Mixed
The parameters to be passed to the structure constructor.
crx_new(length, structureDefinitionOrStructureName, [parameter01, parameter02, ...])
The number of instances to create
parameter01, parameter02, ...
Mixed
The parameters to be passed to the structure constructor. The parameters are passed
for each construction. Optional.
An array of structure instances
crx_new(length, parametersArray, structureDefinitionOrStructureName)
parametersArray
Array of Arrays
An an array of arrays such as parametersArray[i] is an array of parameters to be passed to the
constructor of instance i; If parametersArray is shorter than the number of instances to create,
the last element is used for the construction of the remaining instances.
An array of structure instances
crx_new(length, parametersFunction, structureDefinitionOrStructureName)
parametersFunction
function
A function that takes a single integer, which is the current index of the instance created, and returns
an array of parameters to be passed to the constructor.
Returns an array of structure instances