UE2:Object operators (UT2004): Difference between revisions

From Unreal Wiki, The Unreal Engine Documentation Site
Auto-generated page
 
m some smaller fixes (typos, copy/paste errors)
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
| part = operators
| part = operators
}}
}}
{{autogenerated}}
Operators below are grouped by type and sorted by precedence.
==Operators==
 
Apart from the operators listed here, there are also a few implicitly declared [[operators]], like assignment and generic struct (in)equality.
 
==Bool operators==
====!bool====
====!bool====
{{code|native(129) static final preoperator [[bool]] '''!''' ([[bool]] '''A''')}}
{{code|native(129) static final preoperator [[bool]] '''!''' ([[bool]] '''A''')}}


<!-- enter operator description -->
Logical negation. Returns ''False'' if the parameter is ''True'' and vice versa.


====++byte====
====bool == bool====
{{code|native(137) static final preoperator [[byte]]&nbsp;'''++''' (out&nbsp;[[byte]]&nbsp;'''A''')}}
{{code|native(242) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}


<!-- enter operator description -->
Equality. Returns ''True'' if both parameters have the same value, otherwise ''False''.


====++int====
====bool != bool====
{{code|native(163) static final preoperator [[int]]&nbsp;'''++''' (out&nbsp;[[int]]&nbsp;'''A''')}}
{{code|native(243) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}


<!-- enter operator description -->
Inequality. Returns ''True'' if the parameters have different values, otherwise ''False''


====-float====
====bool && bool====
{{code|native(169) static final preoperator [[float]]&nbsp;'''-''' ([[float]]&nbsp;'''A''')}}
{{code|native(130) static final operator(30) [[bool]]&nbsp;'''&&''' ([[bool]]&nbsp;'''A''', skip&nbsp;[[bool]]&nbsp;'''B''')}}


<!-- enter operator description -->
Logical [[wp:Logical conjunction|AND]]. Returns ''True'' if both parameters are ''True'', otherwise ''False''.


====-int====
This operator "short-circuits" if the first operand evaluates to ''False'', i.e. in that case the second operand is not evaluated at all because the result is already known.
{{code|native(143) static final preoperator [[int]]&nbsp;'''-''' ([[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
====bool ^^ bool====
{{code|native(131) static final operator(30) [[bool]]&nbsp;'''^^''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}


====-vector====
Logical [[wp:Exclusive or|XOR]]. This is basically the same as the '''!=''' operator, except that the inequality operator binds more tightly than XOR.
{{code|native(211) static final preoperator {{tl|Vector||Object structs}}&nbsp;'''-''' ({{tl|Vector||Object structs}}&nbsp;'''A''')}}


<!-- enter operator description -->
====bool || bool====
{{code|native(132) static final operator(32) [[bool]]&nbsp;'''&#124;&#124;''' ([[bool]]&nbsp;'''A''', skip&nbsp;[[bool]]&nbsp;'''B''')}}


====--byte====
Logical [[wp:Logical disjunction|OR]]. Returns ''True'' if any parameter is ''True'', and ''False'' only if both parameters are ''False''.
{{code|native(138) static final preoperator [[byte]]&nbsp;'''--''' (out&nbsp;[[byte]]&nbsp;'''A''')}}


<!-- enter operator description -->
This operator "short-circuits" if the first operand evaluates to ''True'', i.e. in that case the second operand is not evaluated at all because the result is already known.


====--int====
==Byte operators==
{{code|native(164) static final preoperator [[int]]&nbsp;'''--''' (out&nbsp;[[int]]&nbsp;'''A''')}}
====++byte====
{{code|native(137) static final preoperator [[byte]]&nbsp;'''++''' (out&nbsp;[[byte]]&nbsp;'''A''')}}


<!-- enter operator description -->
Preincrement operator. The value of ''A'' is incremented by one and the result is returned.


====~int====
====--byte====
{{code|native(141) static final preoperator [[int]]&nbsp;'''~''' ([[int]]&nbsp;'''A''')}}
{{code|native(138) static final preoperator [[byte]]&nbsp;'''--''' (out&nbsp;[[byte]]&nbsp;'''A''')}}


<!-- enter operator description -->
Predecrement operator. The value of ''A'' is decremented by one and the result is returned.


====byte++====
====byte++====
{{code|native(139) static final postoperator [[byte]]&nbsp;'''++''' (out&nbsp;[[byte]]&nbsp;'''A''')}}
{{code|native(139) static final postoperator [[byte]]&nbsp;'''++''' (out&nbsp;[[byte]]&nbsp;'''A''')}}


<!-- enter operator description -->
Postincrement operator. The value of ''A'' is temporarily stored, then ''A'' is incremented by one and the original value is returned.


====int++====
====byte--====
{{code|native(165) static final postoperator [[int]]&nbsp;'''++''' (out&nbsp;[[int]]&nbsp;'''A''')}}
{{code|native(140) static final postoperator [[byte]]&nbsp;'''--''' (out&nbsp;[[byte]]&nbsp;'''A''')}}


<!-- enter operator description -->
Postdecrement operator. The value of ''A'' is temporarily stored, then ''A'' is decremented by one and the original value is returned.


====byte--====
====byte *= byte====
{{code|native(140) static final postoperator [[byte]]&nbsp;'''--''' (out&nbsp;[[byte]]&nbsp;'''A''')}}
{{code|native(133) static final operator(34) [[byte]]&nbsp;'''*&#61;''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined multiplication and assign. Multiplies ''A'' with ''B'', stores the result in ''A'' and returns it. Note that [[float]] values are automatically [[typecasted]] to ''byte'' for this operator:
<uscript>
local byte b;
b = 4;
b *= 2.5; // afterwards b is 8, not 10
</uscript>


====int--====
====byte += byte====
{{code|native(166) static final postoperator [[int]]&nbsp;'''--''' (out&nbsp;[[int]]&nbsp;'''A''')}}
{{code|native(135) static final operator(34) [[byte]]&nbsp;'''+&#61;''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined add and assign. Adds ''A'' and ''B'', stores the result in ''A'' and returns it.


====float ** float====
====byte -= byte====
{{code|native(170) static final operator(12) [[float]]&nbsp;'''**''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(136) static final operator(34) [[byte]]&nbsp;'''-&#61;''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined subtract and assign. Subtracts ''B'' from ''A'', stores the result in ''A'' and returns it.


====float * float====
====byte /= byte====
{{code|native(171) static final operator(16) [[float]]&nbsp;'''*''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(134) static final operator(34) [[byte]]&nbsp;'''/&#61;''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined divide and assign. Divides ''A'' by ''B'', stores the result in ''A'' and returns it. Note that [[float]] values are automatically [[typecasted]] to ''byte'' for this operator:
<uscript>
local byte b;
b = 10;
b /= 2.5; // afterwards b is 5, not 4
</uscript>
If you need a floating point operation, use <code>A *= 1.0 / B;</code> instead.


====float * rotator====
==Int operators==
{{code|native(288) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''*''' ([[float]]&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}
====++int====
{{code|native(163) static final preoperator [[int]]&nbsp;'''++''' (out&nbsp;[[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
Preincrement operator. The value of ''A'' is incremented by one and the result is returned.


====float * vector====
====-int====
{{code|native(213) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ([[float]]&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
{{code|native(143) static final preoperator [[int]]&nbsp;'''-''' ([[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
Arithmetic negation. The result is a number with the same magnitude, but opposite sign. For zero ''A'' the result obviously is 0. Note that this operator maps the smallest possible int number (-2147483648 or 0x80000000) onto itself because its positive counterpart is larger than the largest possible int number.


====int * int====
====--int====
{{code|native(144) static final operator(16) [[int]]&nbsp;'''*''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(164) static final preoperator [[int]]&nbsp;'''--''' (out&nbsp;[[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
Predecrement operator. The value of ''A'' is decremented by one and the result is returned.


====rotator * float====
====~int====
{{code|native(287) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''*''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(141) static final preoperator [[int]]&nbsp;'''~''' ([[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
[[wp:Bitwise NOT|Bitwise NOT]], or complement operator. Inverts all bits in the binary representation of ''A'' and returns that value.


====vector * float====
====int++====
{{code|native(212) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ({{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(165) static final postoperator [[int]]&nbsp;'''++''' (out&nbsp;[[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
Postincrement operator. The value of ''A'' is temporarily stored, then ''A'' is incremented by one and the original value is returned.


====vector * vector====
====int--====
{{code|native(296) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
{{code|native(166) static final postoperator [[int]]&nbsp;'''--''' (out&nbsp;[[int]]&nbsp;'''A''')}}


<!-- enter operator description -->
Postdecrement operator. The value of ''A'' is temporarily stored, then ''A'' is decremented by one and the original value is returned.


====float / float====
====int * int====
{{code|native(172) static final operator(16) [[float]]&nbsp;'''/''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(144) static final operator(16) [[int]]&nbsp;'''*''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Integer multiplication. Multiplies ''A'' and ''B'' and returns the result.


====int / int====
====int / int====
{{code|native(145) static final operator(16) [[int]]&nbsp;'''/''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(145) static final operator(16) [[int]]&nbsp;'''/''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Integer division. Divides ''A'' by ''B'' and returns the result. Any remainder after division is lost. Division by 0 is defined to return 0.


====rotator / float====
====int + int====
{{code|native(289) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''/''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(146) static final operator(20) [[int]]&nbsp;'''+''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Integer addition. Adds ''A'' and ''B'' and returns the result.


====vector / float====
====int - int====
{{code|native(214) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''/''' ({{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(147) static final operator(20) [[int]]&nbsp;'''-''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Integer subtraction. Subtracts ''B'' from ''A'' and returns the result.


====vector Cross vector====
====int << int====
{{code|native(220) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''Cross''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
{{code|native(148) static final operator(22) [[int]]&nbsp;'''<<''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Arithmetic or logical left shift. Moves the bits in the binary representation of ''A'' to the left. Higher bits are "pushed out" to the left and from the right, zero bits are "pushed in". Arithmetic left shift corresponds to integer multiplication with 2<sup>''B''</sup>.


====vector Dot vector====
''B'' is the distance to shift the bits. If it is negative or greater than 31, ''B'' is implicitly normalized to the range 0 to 31 as if by <code>B & 0x1F</code>.
{{code|native(219) static final operator(16) [[float]]&nbsp;'''Dot''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int >> int====
{{code|native(149) static final operator(22) [[int]]&nbsp;'''>>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====float % float====
Arithmetic right shift. Moves the bits in the binary representation of ''A'' to the right. Lower bits are "pushed out" to the right and depending on the sign of the value, either 0 (for positive numbers) or 1 (for negative numbers) bits are "pushed in" from the left. Arithmetic right shift corresponds to integer division by 2<sup>''B''</sup>.
{{code|native(173) static final operator(18) [[float]]&nbsp;'''%''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
''B'' is the distance to shift the bits. If it is negative or greater than 31, ''B'' is implicitly normalized to the range 0 to 31 as if by <code>B & 0x1F</code>.


====float + float====
====int >>> int====
{{code|native(174) static final operator(20) [[float]]&nbsp;'''+''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(196) static final operator(22) [[int]]&nbsp;'''>>>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Logical right shift. Moves the bits in the binary representation of ''A'' to the right. Higher bits are "pushed out" to the left and from the right, zero bits are "pushed in".


====int + int====
''B'' is the distance to shift the bits. If it is negative or greater than 31, ''B'' is implicitly normalized to the range 0 to 31 as if by <code>B & 0x1F</code>.
{{code|native(146) static final operator(20) [[int]]&nbsp;'''+''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
====int < int====
{{code|native(150) static final operator(24) [[bool]]&nbsp;'''<''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====rotator + rotator====
Less-than comparison operator. Returns ''True'' if the value of ''A'' is less than the value of ''B''.
{{code|native(316) static final operator(20) {{tl|Rotator||Object structs}}&nbsp;'''+''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int <= int====
{{code|native(152) static final operator(24) [[bool]]&nbsp;'''<&#61;''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====vector + vector====
Less-or-equal comparison operator. Returns ''True'' if the value of ''A'' is less than or equal to the value of ''B''.
{{code|native(215) static final operator(20) {{tl|Vector||Object structs}}&nbsp;'''+''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int == int====
{{code|native(154) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====float - float====
Equality operator. Returns ''True'' if the value of ''A'' is equal to the value of ''B''.
{{code|native(175) static final operator(20) [[float]]&nbsp;'''-''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
====int > int====
{{code|native(151) static final operator(24) [[bool]]&nbsp;'''>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====int - int====
Greater-than comparison operator. Returns ''True'' if the value of ''A'' is greater than the value of ''B''.
{{code|native(147) static final operator(20) [[int]]&nbsp;'''-''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
====int >= int====
{{code|native(153) static final operator(24) [[bool]]&nbsp;'''>&#61;''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====rotator - rotator====
Greater-or-equal comparison operator. Returns ''True'' if the value of ''A'' is greater than or equal to the value of ''B''.
{{code|native(317) static final operator(20) {{tl|Rotator||Object structs}}&nbsp;'''-''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int != int====
{{code|native(155) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====vector - vector====
Inequality operator. Returns ''True'' if the value of ''A'' differs from the value of ''B''.
{{code|native(216) static final operator(20) {{tl|Vector||Object structs}}&nbsp;'''-''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int & int====
{{code|native(156) static final operator(28) [[int]]&nbsp;'''&''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====int << int====
[[wp:Bitwise AND|Bitwise AND]] operator. Performs logical AND on each corresponding pair of bits from ''A'' and ''B'' and returns the result. Unlike the {{tl|bool && bool}} operator, the bitwise AND operator always evaluates both operands.
{{code|native(148) static final operator(22) [[int]]&nbsp;'''<<''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
====int ^ int====
{{code|native(157) static final operator(28) [[int]]&nbsp;'''^''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====vector << rotator====
[[wp:Bitwise XOR|Bitwise XOR]] operator. Performs logical XOR on each corresponding pair of bits from ''A'' and ''B'' and returns the result.
{{code|native(275) static final operator(22) {{tl|Vector||Object structs}}&nbsp;'''<<''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int | int====
{{code|native(158) static final operator(28) [[int]]&nbsp;'''&#124;''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====int >> int====
[[wp:Bitwise OR|Bitwise OR]] operator. Performs logical OR on each corresponding pair of bits from ''A'' and ''B'' and returns the result. Unlike the logical OR operator, the bitwise OR operator always evaluates both operands.
{{code|native(149) static final operator(22) [[int]]&nbsp;'''>>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
====int *= float====
{{code|native(159) static final operator(34) [[int]]&nbsp;'''*&#61;''' (out&nbsp;[[int]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


====vector >> rotator====
Combined multiply and assign. Multiplies ''A'' and ''B'', stores the result in ''A'' and returns it.
{{code|native(276) static final operator(22) {{tl|Vector||Object structs}}&nbsp;'''>>''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
'''Note:''' This operator always performs floating point multiplication and thus may be inaccurate for large values. If you need precision for large values, use <code>A = A * B</code> instead.


====int >>> int====
====int += int====
{{code|native(196) static final operator(22) [[int]]&nbsp;'''>>>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(161) static final operator(34) [[int]]&nbsp;'''+&#61;''' (out&nbsp;[[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined add and assign. Adds ''A'' and ''B'', stores the result in ''A'' and returns it.


====float < float====
====int -= int====
{{code|native(176) static final operator(24) [[bool]]&nbsp;'''<''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(162) static final operator(34) [[int]]&nbsp;'''-&#61;''' (out&nbsp;[[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined subtract and assign. Subtracts ''B'' from ''A'', stores the result in ''A'' and returns it.


====int < int====
====int /= float====
{{code|native(150) static final operator(24) [[bool]]&nbsp;'''<''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(160) static final operator(34) [[int]]&nbsp;'''/&#61;''' (out&nbsp;[[int]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined divide and assign. Divides ''A'' by ''B'', stores the result in ''A'' and returns it.


====string < string====
'''Note:''' This operator always performs floating point division and thus may be inaccurate for large values. If you need precision for large values, use <code>A = A / B</code> instead.
{{code|native(115) static final operator(24) [[bool]]&nbsp;'''<''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
==Float operators==
Some floating point operators have the potential of overflowing the valid range of [[float]] values. If this happens, they return a "float error value". Such a value also propagates through operators and function calls if it is passed as a parameter.


====float <= float====
====-float====
{{code|native(178) static final operator(24) [[bool]]&nbsp;'''<=''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(169) static final preoperator [[float]]&nbsp;'''-''' ([[float]]&nbsp;'''A''')}}


<!-- enter operator description -->
Arithmetic negation. The result is a number with the same magnitude, but opposite sign. For zero ''A'' the result obviously is 0.


====int <= int====
====float ** float====
{{code|native(152) static final operator(24) [[bool]]&nbsp;'''<=''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(170) static final operator(12) [[float]]&nbsp;'''**''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
[[wp:Exponentiation|Exponentiation]] operator. Raises ''A'' to the power of ''B'' and returns the result. Attempting to raise a negative number to a fractional power results in [[wp:NaN|NaN]].


====string <= string====
====float * float====
{{code|native(120) static final operator(24) [[bool]]&nbsp;'''<=''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
{{code|native(171) static final operator(16) [[float]]&nbsp;'''*''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Floating point multiplication. Multiplies ''A'' and ''B'' and returns the result.


====bool == bool====
====float / float====
{{code|native(242) static final operator(24) [[bool]]&nbsp;'''==''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}
{{code|native(172) static final operator(16) [[float]]&nbsp;'''/''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Floating point division. Divides ''A'' by ''B'' and returns the result. Division by zero results in [[wp:NaN|NaN]].


====float == float====
====float % float====
{{code|native(180) static final operator(24) [[bool]]&nbsp;'''==''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(173) static final operator(18) [[float]]&nbsp;'''%''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Remainder after (truncated) division, also called the [[wp:modulo operator|modulo operator]]. Divides ''A'' by ''B'' and returns the remainder. Division by zero results in [[wp:NaN|NaN]]. For negative values of ''A'', the result is negative as well.


====int == int====
====float + float====
{{code|native(154) static final operator(24) [[bool]]&nbsp;'''==''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(174) static final operator(20) [[float]]&nbsp;'''+''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Floating point addition. Adds ''A'' and ''B'' and returns the result.


====name == name====
====float - float====
{{code|native(254) static final operator(24) [[bool]]&nbsp;'''==''' ([[name]]&nbsp;'''A''', [[name]]&nbsp;'''B''')}}
{{code|native(175) static final operator(20) [[float]]&nbsp;'''-''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Floating point subtraction. Subtracts ''B'' from ''A'' and returns the result.


====Object == Object====
====float < float====
{{code|native(114) static final operator(24) [[bool]]&nbsp;'''==''' ({{cl|Object}}&nbsp;'''A''', {{cl|Object}}&nbsp;'''B''')}}
{{code|native(176) static final operator(24) [[bool]]&nbsp;'''<''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Less-than comparison operator. Returns ''True'' if the value of ''A'' is less than the value of ''B''.


====rotator == rotator====
====float <= float====
{{code|native(142) static final operator(24) [[bool]]&nbsp;'''==''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}
{{code|native(178) static final operator(24) [[bool]]&nbsp;'''<&#61;''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Less-or-equal comparison operator. Returns ''True'' if the value of ''A'' is less than or equal to the value of ''B''.


====string == string====
====float == float====
{{code|native(122) static final operator(24) [[bool]]&nbsp;'''==''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
{{code|native(180) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
 
<!-- enter operator description -->


====vector == vector====
Equality comparison operator. Returns ''True'' if the value of ''A'' is equal to the value of ''B''.
{{code|native(217) static final operator(24) [[bool]]&nbsp;'''==''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
 
<!-- enter operator description -->


====float > float====
====float > float====
{{code|native(177) static final operator(24) [[bool]]&nbsp;'''>''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(177) static final operator(24) [[bool]]&nbsp;'''>''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Greater-than comparison operator. Returns ''True'' if the value of ''A'' is greater than to the value of ''B''.


====int > int====
====float >= float====
{{code|native(151) static final operator(24) [[bool]]&nbsp;'''>''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(179) static final operator(24) [[bool]]&nbsp;'''>&#61;''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Greater-or-equal comparison operator. Returns ''True'' if the value of ''A'' is greater than or equal to the value of ''B''.


====string > string====
====float ~= float====
{{code|native(116) static final operator(24) [[bool]]&nbsp;'''>''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
{{code|native(210) static final operator(24) [[bool]]&nbsp;'''~&#61;''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Approximately-equal comparison operator. Returns ''True'' if the values of ''A'' and ''B'' differ by less than 0.0001.


====float >= float====
====float != float====
{{code|native(179) static final operator(24) [[bool]]&nbsp;'''>=''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(181) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Inequality comparison operator. Returns ''True'' if the value of ''A'' is different from the value of ''B''.


====int >= int====
====float *= float====
{{code|native(153) static final operator(24) [[bool]]&nbsp;'''>=''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(182) static final operator(34) [[float]]&nbsp;'''*&#61;''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined multiply and assign. Multiplies ''A'' and ''B'', stores the result in ''A'' and returns it.


====string >= string====
====float += float====
{{code|native(121) static final operator(24) [[bool]]&nbsp;'''>=''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
{{code|native(184) static final operator(34) [[float]]&nbsp;'''+&#61;''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined add and assign. Adds ''A'' and ''B'', stores the result in ''A'' and returns it.


====int ClockwiseFrom int====
====float -= float====
{{code|native static final operator(24) [[bool]]&nbsp;'''ClockwiseFrom''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(185) static final operator(34) [[float]]&nbsp;'''-&#61;''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined subtract and assign. Subtracts ''B'' from ''A'', stores the result in ''A'' and returns it.


====float ~= float====
====float /= float====
{{code|native(210) static final operator(24) [[bool]]&nbsp;'''~=''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(183) static final operator(34) [[float]]&nbsp;'''/&#61;''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined divide and assign. Divides ''A'' by ''B'', stores the result in ''A'' and returns it.


====string ~= string====
==Vector operators==
{{code|native(124) static final operator(24) [[bool]]&nbsp;'''~=''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
====-vector====
{{code|native(211) static final preoperator {{tl|Vector||Object structs}}&nbsp;'''-''' ({{tl|Vector||Object structs}}&nbsp;'''A''')}}


<!-- enter operator description -->
Inverts the vector by negating its components. The resulting vector has the same length, but points in the opposite direction.


====bool != bool====
====float * vector====
{{code|native(243) static final operator(26) [[bool]]&nbsp;'''!=''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}
{{code|native(213) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ([[float]]&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Multiplies the vector's components by a scalar value. The resulting vector's length it the original vector's length multiplied by the absolute value of the scalar. Its direction is the same if the scalar is positive and inversed if the scalar is negative.


====float != float====
====vector * float====
{{code|native(181) static final operator(26) [[bool]]&nbsp;'''!=''' ([[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(212) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ({{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Same as {{tl|float * vector}}, just with swapped operands.


====int != int====
====vector * vector====
{{code|native(155) static final operator(26) [[bool]]&nbsp;'''!=''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(296) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''*''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Multiplies the corresponding components of the two vectors and returns them as the corresponding commponents of the resulting vector.


====name != name====
====vector / float====
{{code|native(255) static final operator(26) [[bool]]&nbsp;'''!=''' ([[name]]&nbsp;'''A''', [[name]]&nbsp;'''B''')}}
{{code|native(214) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''/''' ({{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Divides the vector's components by a scalar value. The resulting vector's length it the original vector's length divided by the absolute value of the scalar. Its direction is the same if the scalar is positive and inversed if the scalar is negative.


====Object != Object====
====vector Cross vector====
{{code|native(119) static final operator(26) [[bool]]&nbsp;'''!=''' ({{cl|Object}}&nbsp;'''A''', {{cl|Object}}&nbsp;'''B''')}}
{{code|native(220) static final operator(16) {{tl|Vector||Object structs}}&nbsp;'''Cross''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Calculates the [[wp:cross product|cross product]] of the two vectors. The result is a vector [[wp:perpenticular|perpenticular]] to both input vectors. Its length is equal to the area of the [[wp:parallelogram|parallelogram]] described by the two vectors.


====rotator != rotator====
====vector Dot vector====
{{code|native(203) static final operator(26) [[bool]]&nbsp;'''!=''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}
{{code|native(219) static final operator(16) [[float]]&nbsp;'''Dot''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Calculates the [[wp:dot product|dot product]] of the two vectors. The result is a scalar value, the sum of the products of corresponding components of the two vectors.


====string != string====
====vector + vector====
{{code|native(123) static final operator(26) [[bool]]&nbsp;'''!=''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
{{code|native(215) static final operator(20) {{tl|Vector||Object structs}}&nbsp;'''+''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Adds the two vectors' corresponding components. The resulting vector can be constructed geometrically by attaching the initial point of vector ''B'' to the endpoint of vector ''A''. Now the vector starting at the initial point of ''A'' and ending at the endpoint of ''B'' has the same length and orientation as the resulting vector.


====vector != vector====
====vector - vector====
{{code|native(218) static final operator(26) [[bool]]&nbsp;'''!=''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
{{code|native(216) static final operator(20) {{tl|Vector||Object structs}}&nbsp;'''-''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Subtracts the components of vector ''B'' from the corresponding components of vector ''A''. The resulting vector can be constructed geometrically by attaching the endpoint of vector ''B'' to the endpoint of vector ''A''. Now the vector starting at the initial point of ''A'' and ending at the initial point of vector ''B'' has the same length and orientation as the resulting vector.


====int & int====
====vector << rotator====
{{code|native(156) static final operator(28) [[int]]&nbsp;'''&''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(275) static final operator(22) {{tl|Vector||Object structs}}&nbsp;'''<<''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Vector local-to-global transformation. Imagine a "view offset" vector, e.g. for the weapon in 1st-person view. Such a vector value describes an offset for when the camera points in positive world X-axis direction, with the camera's "up" direction being the same as the world's "up" direction. Now imagine the camera is oriented a different way and the view offset vector needs to be transformed to world coordinates. This is exactly what <code>OffsetVector << CameraRotation</code> does.


====int ^ int====
Often the {{tl|GetAxes||Object static native functions}}() function is used for the same transformation:
{{code|native(157) static final operator(28) [[int]]&nbsp;'''^''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
<uscript>
local vector CamX, CamY, CamZ, Result;


<!-- enter operator description -->
GetAxes(CameraRotation, CamX, CamY, CamZ);
Result = OffsetVector.X * CamX + OffsetVector.Y * CamY + OffsetVector.Z * CamZ;
</uscript>


====int | int====
====vector >> rotator====
{{code|native(158) static final operator(28) [[int]]&nbsp;'''|''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(276) static final operator(22) {{tl|Vector||Object structs}}&nbsp;'''>>''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Vector global-to-local transformation. This operation is the reverse of the {{tl|vector << rotator}} operator, as it could be used to transform an offset vector from world coordinates to local camera coordinates. The code example would be largely the same, except that {{tl|GetUnAxes||Object static native functions}}() would be used,


====bool && bool====
====vector == vector====
{{code|native(130) static final operator(30) [[bool]]&nbsp;'''&&''' ([[bool]]&nbsp;'''A''', skip&nbsp;[[bool]]&nbsp;'''B''')}}
{{code|native(217) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Vector equality operator. Returns ''True'' if both vectors have the same length and orientation, which can only be true if their corresponding components are equal.


====bool ^^ bool====
====vector != vector====
{{code|native(131) static final operator(30) [[bool]]&nbsp;'''^^''' ([[bool]]&nbsp;'''A''', [[bool]]&nbsp;'''B''')}}
{{code|native(218) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ({{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Vector inequality operator. Returns ''True'' if the two vectors differ in length or orientation, which happens if any of the corresponding components are different.


====bool || bool====
====vector *= float====
{{code|native(132) static final operator(32) [[bool]]&nbsp;'''||''' ([[bool]]&nbsp;'''A''', skip&nbsp;[[bool]]&nbsp;'''B''')}}
{{code|native(221) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''*&#61;''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined scalar multiply and assign. Multiplies vector ''A'' by scalar value ''B'', stores the result in ''A'' and returns it.


====byte *= byte====
====vector *= vector====
{{code|native(133) static final operator(34) [[byte]]&nbsp;'''*=''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}
{{code|native(297) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''*&#61;''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Combined vector component multiply and assign. Multiplies the corresponding components of ''A'' and ''B'', stores the resulting vector in ''A'' and returns is.


====float *= float====
====vector += vector====
{{code|native(182) static final operator(34) [[float]]&nbsp;'''*=''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(223) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''+&#61;''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Combined vector add and assign. Adds ''A'' and ''B'', stores the resulting vector in ''A'' and returns it.


====int *= float====
====vector -= vector====
{{code|native(159) static final operator(34) [[int]]&nbsp;'''*=''' (out&nbsp;[[int]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(224) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''-&#61;''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
 
Combined vector subtract and assign. Subtracts ''B'' from ''A'', stores the resulting vector in ''A'' and returns it.


<!-- enter operator description -->
====vector /= float====
{{code|native(222) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''/&#61;''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


====rotator *= float====
Combined scalar divide and assign. Divides vector ''A'' by scalar ''B'', stores the result in ''A'' and returns it.
{{code|native(290) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''*=''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
==Rotator operators==
====float * rotator====
{{code|native(288) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''*''' ([[float]]&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


====vector *= float====
Multiplies each component of the rotator with the float value and returns the resulting rotator. This operator probably makes more sense for rotation rates than for object orientations. Note that rotator components are of type [[int]], so the results will have their fractional part truncated.
{{code|native(221) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''*=''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
====rotator * float====
{{code|native(287) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''*''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


====vector *= vector====
Same as {{tl|float * rotator}}, just with the operands swapped.
{{code|native(297) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''*=''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====rotator / float====
{{code|native(289) static final operator(16) {{tl|Rotator||Object structs}}&nbsp;'''/''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


====byte += byte====
Divides each component of the rotator by the float value and returns the resulting rotator. This operator probably makes more sense for rotation rates than for object orientations. Note that rotator components are of type [[int]], so the results will have their fractional part truncated.
{{code|native(135) static final operator(34) [[byte]]&nbsp;'''+=''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}


<!-- enter operator description -->
====rotator + rotator====
{{code|native(316) static final operator(20) {{tl|Rotator||Object structs}}&nbsp;'''+''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


====float += float====
Adds the corresponding components of the rotators and returns the resulting rotator.
{{code|native(184) static final operator(34) [[float]]&nbsp;'''+=''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
====rotator - rotator====
{{code|native(317) static final operator(20) {{tl|Rotator||Object structs}}&nbsp;'''-''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


====int += int====
Subtracts the component values of ''B'' from the corresponding components of ''A'' and returns the resulting rotator.
{{code|native(161) static final operator(34) [[int]]&nbsp;'''+=''' (out&nbsp;[[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


<!-- enter operator description -->
====rotator == rotator====
{{code|native(142) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


====rotator += rotator====
Rotator equality. Returns ''True'' if the corresponding components of the two rotators have identical values. To compare rotators for orientation, if may be necessary to {{tl|Normalize||Object static native functions}}() their components first. Sometimes that doesn't work either: for example <code>rot(0,32768,0) != rot(32768,0,32768)</code> even though these two rotator literals actually have the same effect if used e.g. as camera rotation.
{{code|native(318) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''+=''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
====int ClockwiseFrom int====
{{code|native static final operator(24) [[bool]]&nbsp;'''ClockwiseFrom''' ([[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}


====vector += vector====
Compares corresponding normalized component values of two rotators and returns ''True'' if the shortest rotation direction from ''A'' to ''B'' would be in clockwise direction, i.e. by incrementing ''A'' until it reaches ''B''.
{{code|native(223) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''+=''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Yes, this is actually an int operator returning a bool result. It is listed here among the rotator operators nonetheless because its use it closely related to rotators.


====byte -= byte====
====rotator != rotator====
{{code|native(136) static final operator(34) [[byte]]&nbsp;'''-=''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}
{{code|native(203) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ({{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Rotator inequality. Returns ''True'' if any corresponding components of the two rotators differ. As mentioned for the <code>==</code> operator above, this doesn't necessarily mean that the rotators represent different orientations.


====float -= float====
====rotator *= float====
{{code|native(185) static final operator(34) [[float]]&nbsp;'''-=''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(290) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''*&#61;''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined rotator multiply and assign. Multiplies each component of rotator ''A'' by ''B'', stores the result in ''A'' and returns it.


====int -= int====
====rotator += rotator====
{{code|native(162) static final operator(34) [[int]]&nbsp;'''-=''' (out&nbsp;[[int]]&nbsp;'''A''', [[int]]&nbsp;'''B''')}}
{{code|native(318) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''+&#61;''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}


<!-- enter operator description -->
Combined rotator add and assign. Adds the corresponding components of rotators ''A'' and ''B'', stores the result in ''A'' and returns it.


====rotator -= rotator====
====rotator -= rotator====
{{code|native(319) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''-=''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}
{{code|native(319) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''-&#61;''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', {{tl|Rotator||Object structs}}&nbsp;'''B''')}}
 
Combined rotator subtract and assign. Subtracts the components of rotator ''B'' from the corresponding components of ''A'', stores the result in ''A'' and returns it.
 
====rotator /= float====
{{code|native(291) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''/&#61;''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined rotator divide and assign. Divides each component of rotator ''A'' by ''B'', stores the result in ''A'' and returns it.


====vector -= vector====
==String operators==
{{code|native(224) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''-=''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', {{tl|Vector||Object structs}}&nbsp;'''B''')}}
====string < string====
{{code|native(115) static final operator(24) [[bool]]&nbsp;'''<''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
 
Compares the strings case-sensitively and returns ''True'' if ''A'' comes before ''B'' in [[wp:lexicographical order|lexicographical order]].
 
====string <= string====
{{code|native(120) static final operator(24) [[bool]]&nbsp;'''<&#61;''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Compares the strings case-sensitively and returns ''True'' if ''A'' is identical to ''B'' or comes before ''B'' in [[wp:lexicographical order|lexicographical order]].


====byte /= byte====
====string == string====
{{code|native(134) static final operator(34) [[byte]]&nbsp;'''/=''' (out&nbsp;[[byte]]&nbsp;'''A''', [[byte]]&nbsp;'''B''')}}
{{code|native(122) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Case-sensitive string equality. Returns ''True'' if ''A'' and ''B'' contain the exact same characters in exactly the same order.


====float /= float====
====string > string====
{{code|native(183) static final operator(34) [[float]]&nbsp;'''/=''' (out&nbsp;[[float]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(116) static final operator(24) [[bool]]&nbsp;'''>''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Compares the strings case-sensitively and returns ''True'' if ''A'' comes after ''B'' in [[wp:lexicographical order|lexicographical order]].


====int /= float====
====string >= string====
{{code|native(160) static final operator(34) [[int]]&nbsp;'''/=''' (out&nbsp;[[int]]&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(121) static final operator(24) [[bool]]&nbsp;'''>&#61;''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Compares the strings case-sensitively and returns ''True'' if ''A'' is identical to ''B'' or comes after ''B'' in [[wp:lexicographical order|lexicographical order]].


====rotator /= float====
====string ~= string====
{{code|native(291) static final operator(34) {{tl|Rotator||Object structs}}&nbsp;'''/=''' (out&nbsp;{{tl|Rotator||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}
{{code|native(124) static final operator(24) [[bool]]&nbsp;'''~&#61;''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}
 
Case-insensitive string equality. Returns ''True'' if the two strings are either equal or only differ by case.


<!-- enter operator description -->
====string != string====
{{code|native(123) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ([[string]]&nbsp;'''A''', [[string]]&nbsp;'''B''')}}


====vector /= float====
Case-sensitive string inequality. Returns ''True'' if the strings do not contain the exact same characters in exactly the same order. This includes different case.
{{code|native(222) static final operator(34) {{tl|Vector||Object structs}}&nbsp;'''/=''' (out&nbsp;{{tl|Vector||Object structs}}&nbsp;'''A''', [[float]]&nbsp;'''B''')}}


<!-- enter operator description -->
To compare two strings for case-insensitive inequality you can either compare their capitalized versions for inequality (<code>Caps(A) != Caps(B)</code>) or negate the result of the case-insensitive equality operator (<code>!(A ~= B)</code>).


====string $ string====
====string $ string====
{{code|native(112) static final operator(40) [[string]]&nbsp;'''$''' (coerce&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
{{code|native(112) static final operator(40) [[string]]&nbsp;'''$''' (coerce&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
String [[wp:concatenation|concatenation]]. Returns a string that contains the content of ''B'' appended to the content of ''A'': <code>"Hello" $ "World"</code> results in the string <code>"HelloWorld"</code>.


====string @ string====
====string @ string====
{{code|native(168) static final operator(40) [[string]]&nbsp;'''@''' (coerce&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
{{code|native(168) static final operator(40) [[string]]&nbsp;'''@''' (coerce&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Spaced string [[wp:concatenation|concatenation]]. Same as {{tl|string $ string}}, but the two strings are separated by a space character in the result: <code>"Hello" @ "World"</code> results in the string <code>"Hello&nbsp;World"</code>.


====string $= string====
====string $= string====
{{code|native(322) static final operator(44) [[string]]&nbsp;'''$=''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
{{code|native(322) static final operator(44) [[string]]&nbsp;'''$&#61;''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined concate and assign. Appends the content of ''B'' to ''A'', stores the result in ''A'' and returns it.


====string @= string====
====string @= string====
{{code|native(323) static final operator(44) [[string]]&nbsp;'''@=''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
{{code|native(323) static final operator(44) [[string]]&nbsp;'''@&#61;''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}


<!-- enter operator description -->
Combined spaced concate and assign. Appends a space character and the content of ''B'' to ''A'', stores the result in ''A'' and returns it.


====string -= string====
====string -= string====
{{code|native(324) static final operator(45) [[string]]&nbsp;'''-=''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
{{code|native(324) static final operator(45) [[string]]&nbsp;'''-&#61;''' (out&nbsp;[[string]]&nbsp;'''A''', coerce&nbsp;[[string]]&nbsp;'''B''')}}
 
Combined string removal and assign. Finds all occurrences of ''B'' in ''A'' and removes them. The result is stored in ''A'' and returned. Occurences of ''B'' that are a result of a removal operation are ignored: <code>"aaabbb" -= "ab"</code> results in <code>"aabb"</code>.
 
==Name operators==
====name == name====
{{code|native(254) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ([[name]]&nbsp;'''A''', [[name]]&nbsp;'''B''')}}
 
Name equality. Returns ''True'' if ''A'' and ''B'' represent the same name value.
 
====name != name====
{{code|native(255) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ([[name]]&nbsp;'''A''', [[name]]&nbsp;'''B''')}}
 
Name inequality. Returns ''True'' if ''A'' and ''B'' represent different name value.
 
==Object operators==
====Object == Object====
{{code|native(114) static final operator(24) [[bool]]&nbsp;'''&#61;&#61;''' ({{cl|Object}}&nbsp;'''A''', {{cl|Object}}&nbsp;'''B''')}}
 
Object equality. Returns ''True'' if ''A'' and ''B'' either point to the same object or are both ''None''.
 
====Object != Object====
{{code|native(119) static final operator(26) [[bool]]&nbsp;'''!&#61;''' ({{cl|Object}}&nbsp;'''A''', {{cl|Object}}&nbsp;'''B''')}}


<!-- enter operator description -->
Object inequality. Returns ''True'' if ''A'' and ''B'' point to different objects or one is ''None'' while the other isn't.

Latest revision as of 02:07, 9 January 2010

UT2004 Object (operators)
Object operators in other games:
Other member categories for this class:

Operators below are grouped by type and sorted by precedence.

Apart from the operators listed here, there are also a few implicitly declared operators, like assignment and generic struct (in)equality.

Bool operators

!bool

native(129) static final preoperator bool ! (bool A)

Logical negation. Returns False if the parameter is True and vice versa.

bool == bool

native(242) static final operator(24) bool == (bool A, bool B)

Equality. Returns True if both parameters have the same value, otherwise False.

bool != bool

native(243) static final operator(26) bool != (bool A, bool B)

Inequality. Returns True if the parameters have different values, otherwise False

bool && bool

native(130) static final operator(30) bool && (bool A, skip bool B)

Logical AND. Returns True if both parameters are True, otherwise False.

This operator "short-circuits" if the first operand evaluates to False, i.e. in that case the second operand is not evaluated at all because the result is already known.

bool ^^ bool

native(131) static final operator(30) bool ^^ (bool A, bool B)

Logical XOR. This is basically the same as the != operator, except that the inequality operator binds more tightly than XOR.

bool || bool

native(132) static final operator(32) bool || (bool A, skip bool B)

Logical OR. Returns True if any parameter is True, and False only if both parameters are False.

This operator "short-circuits" if the first operand evaluates to True, i.e. in that case the second operand is not evaluated at all because the result is already known.

Byte operators

++byte

native(137) static final preoperator byte ++ (out byte A)

Preincrement operator. The value of A is incremented by one and the result is returned.

--byte

native(138) static final preoperator byte -- (out byte A)

Predecrement operator. The value of A is decremented by one and the result is returned.

byte++

native(139) static final postoperator byte ++ (out byte A)

Postincrement operator. The value of A is temporarily stored, then A is incremented by one and the original value is returned.

byte--

native(140) static final postoperator byte -- (out byte A)

Postdecrement operator. The value of A is temporarily stored, then A is decremented by one and the original value is returned.

byte *= byte

native(133) static final operator(34) byte *= (out byte A, byte B)

Combined multiplication and assign. Multiplies A with B, stores the result in A and returns it. Note that float values are automatically typecasted to byte for this operator: <uscript> local byte b; b = 4; b *= 2.5; // afterwards b is 8, not 10 </uscript>

byte += byte

native(135) static final operator(34) byte += (out byte A, byte B)

Combined add and assign. Adds A and B, stores the result in A and returns it.

byte -= byte

native(136) static final operator(34) byte -= (out byte A, byte B)

Combined subtract and assign. Subtracts B from A, stores the result in A and returns it.

byte /= byte

native(134) static final operator(34) byte /= (out byte A, byte B)

Combined divide and assign. Divides A by B, stores the result in A and returns it. Note that float values are automatically typecasted to byte for this operator: <uscript> local byte b; b = 10; b /= 2.5; // afterwards b is 5, not 4 </uscript> If you need a floating point operation, use A *= 1.0 / B; instead.

Int operators

++int

native(163) static final preoperator int ++ (out int A)

Preincrement operator. The value of A is incremented by one and the result is returned.

-int

native(143) static final preoperator int - (int A)

Arithmetic negation. The result is a number with the same magnitude, but opposite sign. For zero A the result obviously is 0. Note that this operator maps the smallest possible int number (-2147483648 or 0x80000000) onto itself because its positive counterpart is larger than the largest possible int number.

--int

native(164) static final preoperator int -- (out int A)

Predecrement operator. The value of A is decremented by one and the result is returned.

~int

native(141) static final preoperator int ~ (int A)

Bitwise NOT, or complement operator. Inverts all bits in the binary representation of A and returns that value.

int++

native(165) static final postoperator int ++ (out int A)

Postincrement operator. The value of A is temporarily stored, then A is incremented by one and the original value is returned.

int--

native(166) static final postoperator int -- (out int A)

Postdecrement operator. The value of A is temporarily stored, then A is decremented by one and the original value is returned.

int * int

native(144) static final operator(16) int * (int A, int B)

Integer multiplication. Multiplies A and B and returns the result.

int / int

native(145) static final operator(16) int / (int A, int B)

Integer division. Divides A by B and returns the result. Any remainder after division is lost. Division by 0 is defined to return 0.

int + int

native(146) static final operator(20) int + (int A, int B)

Integer addition. Adds A and B and returns the result.

int - int

native(147) static final operator(20) int - (int A, int B)

Integer subtraction. Subtracts B from A and returns the result.

int << int

native(148) static final operator(22) int << (int A, int B)

Arithmetic or logical left shift. Moves the bits in the binary representation of A to the left. Higher bits are "pushed out" to the left and from the right, zero bits are "pushed in". Arithmetic left shift corresponds to integer multiplication with 2B.

B is the distance to shift the bits. If it is negative or greater than 31, B is implicitly normalized to the range 0 to 31 as if by B & 0x1F.

int >> int

native(149) static final operator(22) int >> (int A, int B)

Arithmetic right shift. Moves the bits in the binary representation of A to the right. Lower bits are "pushed out" to the right and depending on the sign of the value, either 0 (for positive numbers) or 1 (for negative numbers) bits are "pushed in" from the left. Arithmetic right shift corresponds to integer division by 2B.

B is the distance to shift the bits. If it is negative or greater than 31, B is implicitly normalized to the range 0 to 31 as if by B & 0x1F.

int >>> int

native(196) static final operator(22) int >>> (int A, int B)

Logical right shift. Moves the bits in the binary representation of A to the right. Higher bits are "pushed out" to the left and from the right, zero bits are "pushed in".

B is the distance to shift the bits. If it is negative or greater than 31, B is implicitly normalized to the range 0 to 31 as if by B & 0x1F.

int < int

native(150) static final operator(24) bool < (int A, int B)

Less-than comparison operator. Returns True if the value of A is less than the value of B.

int <= int

native(152) static final operator(24) bool <= (int A, int B)

Less-or-equal comparison operator. Returns True if the value of A is less than or equal to the value of B.

int == int

native(154) static final operator(24) bool == (int A, int B)

Equality operator. Returns True if the value of A is equal to the value of B.

int > int

native(151) static final operator(24) bool > (int A, int B)

Greater-than comparison operator. Returns True if the value of A is greater than the value of B.

int >= int

native(153) static final operator(24) bool >= (int A, int B)

Greater-or-equal comparison operator. Returns True if the value of A is greater than or equal to the value of B.

int != int

native(155) static final operator(26) bool != (int A, int B)

Inequality operator. Returns True if the value of A differs from the value of B.

int & int

native(156) static final operator(28) int & (int A, int B)

Bitwise AND operator. Performs logical AND on each corresponding pair of bits from A and B and returns the result. Unlike the bool && bool operator, the bitwise AND operator always evaluates both operands.

int ^ int

native(157) static final operator(28) int ^ (int A, int B)

Bitwise XOR operator. Performs logical XOR on each corresponding pair of bits from A and B and returns the result.

int | int

native(158) static final operator(28) int | (int A, int B)

Bitwise OR operator. Performs logical OR on each corresponding pair of bits from A and B and returns the result. Unlike the logical OR operator, the bitwise OR operator always evaluates both operands.

int *= float

native(159) static final operator(34) int *= (out int A, float B)

Combined multiply and assign. Multiplies A and B, stores the result in A and returns it.

Note: This operator always performs floating point multiplication and thus may be inaccurate for large values. If you need precision for large values, use A = A * B instead.

int += int

native(161) static final operator(34) int += (out int A, int B)

Combined add and assign. Adds A and B, stores the result in A and returns it.

int -= int

native(162) static final operator(34) int -= (out int A, int B)

Combined subtract and assign. Subtracts B from A, stores the result in A and returns it.

int /= float

native(160) static final operator(34) int /= (out int A, float B)

Combined divide and assign. Divides A by B, stores the result in A and returns it.

Note: This operator always performs floating point division and thus may be inaccurate for large values. If you need precision for large values, use A = A / B instead.

Float operators

Some floating point operators have the potential of overflowing the valid range of float values. If this happens, they return a "float error value". Such a value also propagates through operators and function calls if it is passed as a parameter.

-float

native(169) static final preoperator float - (float A)

Arithmetic negation. The result is a number with the same magnitude, but opposite sign. For zero A the result obviously is 0.

float ** float

native(170) static final operator(12) float ** (float A, float B)

Exponentiation operator. Raises A to the power of B and returns the result. Attempting to raise a negative number to a fractional power results in NaN.

float * float

native(171) static final operator(16) float * (float A, float B)

Floating point multiplication. Multiplies A and B and returns the result.

float / float

native(172) static final operator(16) float / (float A, float B)

Floating point division. Divides A by B and returns the result. Division by zero results in NaN.

float % float

native(173) static final operator(18) float % (float A, float B)

Remainder after (truncated) division, also called the modulo operator. Divides A by B and returns the remainder. Division by zero results in NaN. For negative values of A, the result is negative as well.

float + float

native(174) static final operator(20) float + (float A, float B)

Floating point addition. Adds A and B and returns the result.

float - float

native(175) static final operator(20) float - (float A, float B)

Floating point subtraction. Subtracts B from A and returns the result.

float < float

native(176) static final operator(24) bool < (float A, float B)

Less-than comparison operator. Returns True if the value of A is less than the value of B.

float <= float

native(178) static final operator(24) bool <= (float A, float B)

Less-or-equal comparison operator. Returns True if the value of A is less than or equal to the value of B.

float == float

native(180) static final operator(24) bool == (float A, float B)

Equality comparison operator. Returns True if the value of A is equal to the value of B.

float > float

native(177) static final operator(24) bool > (float A, float B)

Greater-than comparison operator. Returns True if the value of A is greater than to the value of B.

float >= float

native(179) static final operator(24) bool >= (float A, float B)

Greater-or-equal comparison operator. Returns True if the value of A is greater than or equal to the value of B.

float ~= float

native(210) static final operator(24) bool ~= (float A, float B)

Approximately-equal comparison operator. Returns True if the values of A and B differ by less than 0.0001.

float != float

native(181) static final operator(26) bool != (float A, float B)

Inequality comparison operator. Returns True if the value of A is different from the value of B.

float *= float

native(182) static final operator(34) float *= (out float A, float B)

Combined multiply and assign. Multiplies A and B, stores the result in A and returns it.

float += float

native(184) static final operator(34) float += (out float A, float B)

Combined add and assign. Adds A and B, stores the result in A and returns it.

float -= float

native(185) static final operator(34) float -= (out float A, float B)

Combined subtract and assign. Subtracts B from A, stores the result in A and returns it.

float /= float

native(183) static final operator(34) float /= (out float A, float B)

Combined divide and assign. Divides A by B, stores the result in A and returns it.

Vector operators

-vector

native(211) static final preoperator Vector - (Vector A)

Inverts the vector by negating its components. The resulting vector has the same length, but points in the opposite direction.

float * vector

native(213) static final operator(16) Vector * (float A, Vector B)

Multiplies the vector's components by a scalar value. The resulting vector's length it the original vector's length multiplied by the absolute value of the scalar. Its direction is the same if the scalar is positive and inversed if the scalar is negative.

vector * float

native(212) static final operator(16) Vector * (Vector A, float B)

Same as float * vector, just with swapped operands.

vector * vector

native(296) static final operator(16) Vector * (Vector A, Vector B)

Multiplies the corresponding components of the two vectors and returns them as the corresponding commponents of the resulting vector.

vector / float

native(214) static final operator(16) Vector / (Vector A, float B)

Divides the vector's components by a scalar value. The resulting vector's length it the original vector's length divided by the absolute value of the scalar. Its direction is the same if the scalar is positive and inversed if the scalar is negative.

vector Cross vector

native(220) static final operator(16) Vector Cross (Vector A, Vector B)

Calculates the cross product of the two vectors. The result is a vector perpenticular to both input vectors. Its length is equal to the area of the parallelogram described by the two vectors.

vector Dot vector

native(219) static final operator(16) float Dot (Vector A, Vector B)

Calculates the dot product of the two vectors. The result is a scalar value, the sum of the products of corresponding components of the two vectors.

vector + vector

native(215) static final operator(20) Vector + (Vector A, Vector B)

Adds the two vectors' corresponding components. The resulting vector can be constructed geometrically by attaching the initial point of vector B to the endpoint of vector A. Now the vector starting at the initial point of A and ending at the endpoint of B has the same length and orientation as the resulting vector.

vector - vector

native(216) static final operator(20) Vector - (Vector A, Vector B)

Subtracts the components of vector B from the corresponding components of vector A. The resulting vector can be constructed geometrically by attaching the endpoint of vector B to the endpoint of vector A. Now the vector starting at the initial point of A and ending at the initial point of vector B has the same length and orientation as the resulting vector.

vector << rotator

native(275) static final operator(22) Vector << (Vector A, Rotator B)

Vector local-to-global transformation. Imagine a "view offset" vector, e.g. for the weapon in 1st-person view. Such a vector value describes an offset for when the camera points in positive world X-axis direction, with the camera's "up" direction being the same as the world's "up" direction. Now imagine the camera is oriented a different way and the view offset vector needs to be transformed to world coordinates. This is exactly what OffsetVector << CameraRotation does.

Often the GetAxes() function is used for the same transformation: <uscript> local vector CamX, CamY, CamZ, Result;

GetAxes(CameraRotation, CamX, CamY, CamZ); Result = OffsetVector.X * CamX + OffsetVector.Y * CamY + OffsetVector.Z * CamZ; </uscript>

vector >> rotator

native(276) static final operator(22) Vector >> (Vector A, Rotator B)

Vector global-to-local transformation. This operation is the reverse of the vector << rotator operator, as it could be used to transform an offset vector from world coordinates to local camera coordinates. The code example would be largely the same, except that GetUnAxes() would be used,

vector == vector

native(217) static final operator(24) bool == (Vector A, Vector B)

Vector equality operator. Returns True if both vectors have the same length and orientation, which can only be true if their corresponding components are equal.

vector != vector

native(218) static final operator(26) bool != (Vector A, Vector B)

Vector inequality operator. Returns True if the two vectors differ in length or orientation, which happens if any of the corresponding components are different.

vector *= float

native(221) static final operator(34) Vector *= (out Vector A, float B)

Combined scalar multiply and assign. Multiplies vector A by scalar value B, stores the result in A and returns it.

vector *= vector

native(297) static final operator(34) Vector *= (out Vector A, Vector B)

Combined vector component multiply and assign. Multiplies the corresponding components of A and B, stores the resulting vector in A and returns is.

vector += vector

native(223) static final operator(34) Vector += (out Vector A, Vector B)

Combined vector add and assign. Adds A and B, stores the resulting vector in A and returns it.

vector -= vector

native(224) static final operator(34) Vector -= (out Vector A, Vector B)

Combined vector subtract and assign. Subtracts B from A, stores the resulting vector in A and returns it.

vector /= float

native(222) static final operator(34) Vector /= (out Vector A, float B)

Combined scalar divide and assign. Divides vector A by scalar B, stores the result in A and returns it.

Rotator operators

float * rotator

native(288) static final operator(16) Rotator * (float A, Rotator B)

Multiplies each component of the rotator with the float value and returns the resulting rotator. This operator probably makes more sense for rotation rates than for object orientations. Note that rotator components are of type int, so the results will have their fractional part truncated.

rotator * float

native(287) static final operator(16) Rotator * (Rotator A, float B)

Same as float * rotator, just with the operands swapped.

rotator / float

native(289) static final operator(16) Rotator / (Rotator A, float B)

Divides each component of the rotator by the float value and returns the resulting rotator. This operator probably makes more sense for rotation rates than for object orientations. Note that rotator components are of type int, so the results will have their fractional part truncated.

rotator + rotator

native(316) static final operator(20) Rotator + (Rotator A, Rotator B)

Adds the corresponding components of the rotators and returns the resulting rotator.

rotator - rotator

native(317) static final operator(20) Rotator - (Rotator A, Rotator B)

Subtracts the component values of B from the corresponding components of A and returns the resulting rotator.

rotator == rotator

native(142) static final operator(24) bool == (Rotator A, Rotator B)

Rotator equality. Returns True if the corresponding components of the two rotators have identical values. To compare rotators for orientation, if may be necessary to Normalize() their components first. Sometimes that doesn't work either: for example rot(0,32768,0) != rot(32768,0,32768) even though these two rotator literals actually have the same effect if used e.g. as camera rotation.

int ClockwiseFrom int

native static final operator(24) bool ClockwiseFrom (int A, int B)

Compares corresponding normalized component values of two rotators and returns True if the shortest rotation direction from A to B would be in clockwise direction, i.e. by incrementing A until it reaches B.

Yes, this is actually an int operator returning a bool result. It is listed here among the rotator operators nonetheless because its use it closely related to rotators.

rotator != rotator

native(203) static final operator(26) bool != (Rotator A, Rotator B)

Rotator inequality. Returns True if any corresponding components of the two rotators differ. As mentioned for the == operator above, this doesn't necessarily mean that the rotators represent different orientations.

rotator *= float

native(290) static final operator(34) Rotator *= (out Rotator A, float B)

Combined rotator multiply and assign. Multiplies each component of rotator A by B, stores the result in A and returns it.

rotator += rotator

native(318) static final operator(34) Rotator += (out Rotator A, Rotator B)

Combined rotator add and assign. Adds the corresponding components of rotators A and B, stores the result in A and returns it.

rotator -= rotator

native(319) static final operator(34) Rotator -= (out Rotator A, Rotator B)

Combined rotator subtract and assign. Subtracts the components of rotator B from the corresponding components of A, stores the result in A and returns it.

rotator /= float

native(291) static final operator(34) Rotator /= (out Rotator A, float B)

Combined rotator divide and assign. Divides each component of rotator A by B, stores the result in A and returns it.

String operators

string < string

native(115) static final operator(24) bool < (string A, string B)

Compares the strings case-sensitively and returns True if A comes before B in lexicographical order.

string <= string

native(120) static final operator(24) bool <= (string A, string B)

Compares the strings case-sensitively and returns True if A is identical to B or comes before B in lexicographical order.

string == string

native(122) static final operator(24) bool == (string A, string B)

Case-sensitive string equality. Returns True if A and B contain the exact same characters in exactly the same order.

string > string

native(116) static final operator(24) bool > (string A, string B)

Compares the strings case-sensitively and returns True if A comes after B in lexicographical order.

string >= string

native(121) static final operator(24) bool >= (string A, string B)

Compares the strings case-sensitively and returns True if A is identical to B or comes after B in lexicographical order.

string ~= string

native(124) static final operator(24) bool ~= (string A, string B)

Case-insensitive string equality. Returns True if the two strings are either equal or only differ by case.

string != string

native(123) static final operator(26) bool != (string A, string B)

Case-sensitive string inequality. Returns True if the strings do not contain the exact same characters in exactly the same order. This includes different case.

To compare two strings for case-insensitive inequality you can either compare their capitalized versions for inequality (Caps(A) != Caps(B)) or negate the result of the case-insensitive equality operator (!(A ~= B)).

string $ string

native(112) static final operator(40) string $ (coerce string A, coerce string B)

String concatenation. Returns a string that contains the content of B appended to the content of A: "Hello" $ "World" results in the string "HelloWorld".

string @ string

native(168) static final operator(40) string @ (coerce string A, coerce string B)

Spaced string concatenation. Same as string $ string, but the two strings are separated by a space character in the result: "Hello" @ "World" results in the string "Hello World".

string $= string

native(322) static final operator(44) string $= (out string A, coerce string B)

Combined concate and assign. Appends the content of B to A, stores the result in A and returns it.

string @= string

native(323) static final operator(44) string @= (out string A, coerce string B)

Combined spaced concate and assign. Appends a space character and the content of B to A, stores the result in A and returns it.

string -= string

native(324) static final operator(45) string -= (out string A, coerce string B)

Combined string removal and assign. Finds all occurrences of B in A and removes them. The result is stored in A and returned. Occurences of B that are a result of a removal operation are ignored: "aaabbb" -= "ab" results in "aabb".

Name operators

name == name

native(254) static final operator(24) bool == (name A, name B)

Name equality. Returns True if A and B represent the same name value.

name != name

native(255) static final operator(26) bool != (name A, name B)

Name inequality. Returns True if A and B represent different name value.

Object operators

Object == Object

native(114) static final operator(24) bool == (Object A, Object B)

Object equality. Returns True if A and B either point to the same object or are both None.

Object != Object

native(119) static final operator(26) bool != (Object A, Object B)

Object inequality. Returns True if A and B point to different objects or one is None while the other isn't.