LogiX:Overloading

From Neos Wiki
Jump to navigation Jump to search

Overloading

Logix is strongly typed, so nodes can only accept a single type of value for each pin. This means there needs to be multiple Logix components for each operator (for instance add for int32, and add for float), however users do not need to care about this because of overloading.

When you assign a pin in Logix with a Logix tooltip, if the pin type does not match the type of the wire you are trying to connect, a search is done to find a different component representing the same operation that has compatible pins. If one is found the node is replaced, and the wire is assigned. If one is not found a cast node may be created, or the assignment fails and the wire is not connected.

Many nodes support overloading with a set of input pins such as the multiplex node, and some nodes can have more exotic overloading patterns such as the x node.

To see overloading in action, assign a float to a + node, then remove the wire and assign an int to the same node. The node should automatically convert to the float overload (which it likely spawned as), and then be converted to an int overload when that wire is connected. Do note that if you attach a float to the first pin, and then an int to the second, a cast node is created instead.