Vector/Sub

From Garry's Mod
Jump to: navigation, search
 Vector:Sub( )

Contents

Description

Substracts the values of the second vector from the orignal vector, this function can be used to avoid garbage collection.

Arguments

Vector vector

The other vector.

Examples

Example

Subtracts vector A's components with the other vector.

a = Vector(5, 6, 7)
a:Sub(Vector(1, 2, 3))
print(a)

Output:

4 4 4

Examples

Example

If you don't want to set your vector to the result, and just return a new vector as the result. You can use a ' - ' operator to subtract two vectors from each other.

a = Vector(5, 6, 7)
print(a-Vector(1, 2, 3))

Output:

4 4 4
Personal tools
Navigation