Copy VEX node

Takes a single input of any data type.

See also: If, While

This operator takes a single input of any data type. It simply creates a copy of the input value, and sends it to the output. This provides a safe means of swapping variable values within a subnet. For example, suppose you have an If VOP that is supposed to swap the first and second input values. If you were to simply connect the subnet input to the subnet output, bad code would be generated. The first output would be assigned the value of the second input, then the second output would be assigned the value of the first input. But the first input value has already been changed to the value of the second input, so the result would be that both output values would equal the second input value.

To make this work properly, simply attach a Copy VOP between the first input and the second output. This fixes the problem because the second output will be assigned the value of the copy of the first input, instead of trying to assign it the value of the first input, which would have already been changed.

Usages in other examples

Example name Example for