Functions Index :: A :: ArrayOpArray

[<< up one level]

Module:

array :: operators

Definition:

ArrayOpArray(string array1, string array2, string operation)

Description:

Performs an operation between corresponding elements of two arrays (ie array1[i] op array2[i]) and returns the resulting array.

Arguments:

array1: The array who's elements will be the left operand of the operation.

array2: The array who's elements will be the right operand of the operation.

operation: The string representation of the operation to be performed between array1 and array2 pairs of elements. All Avisynth operations that are valid for the specific type of elements are supported ("+", "-", "*", "/", "%", "==", "!=", ">=", "<=", "<", ">", "&&", "||", etc.)

Notes and conditions on arguments relations:

1] The type of array1 and of array2 elements must be compatible with respect to the chosen operation.

2] When performing division with ints Avisynth truncates the result to an int. If you want float results, make either array1 or array2 elements floats (you can use a call like this: ArrayOpFunc(my_array, "Float") ).

Examples:

a1 = "2,3,5,-6,7,8"

a2 = "3,4,-5,6,-7,8"

c1 = AVISource(...)

...

c6 = AVISource(...)

a3 = ArrayCreate(c1, c2, c3)

a4 = ArrayCreate(c4, c5, c6)

r1 = ArrayOpArray(a1, a2, "+") # r1 == "5,7,0,0,0,16"

r2 = ArrayOpArray(a1, a2, "-") # r2 == "-1,-1,10,-12,14,0"

r3 = ArrayOpArray(a1, a2, "<=") # r3 == "true,true,false,true,false,true"

r4 = ArrayOpArray(a3, a4, "+")

# r4 contains clips {(c1+c4),(c2+c5),(c3+c6)}

 

[<< top]

 

More examples and in-depth explanation of operator functions can be found at the "Container operators" tutorial.