1
0
Fork 0

props.nas: Add function to swap the values of two property nodes

This commit is contained in:
TheFGFSEagle 2023-10-03 21:49:32 +02:00
parent 590770e555
commit d65228be6c

View file

@ -484,6 +484,22 @@ var runBinding = func(node, module = nil) {
condition(node.getNode("condition")) ? fgcommand(cmd, node) : 0;
}
##
# Swaps the value of two property nodes, like the property-swap command
#
var swapValues = func(left, right) {
if (!isa(left, Node)) {
left = props.globals.getNode(left);
}
if (!isa(right, Node)) {
right = props.globals.getNode(right);
}
var leftValue = left.getValue();
var rightValue = right.getValue();
left.setValue(rightValue);
right.setValue(leftValue);
}
#---------------------------------------------------------------------------
# Property / object update manager
#