Garry's Mod Wiki

Vector:Add

Vector:Add( Vector vector )

Description

Adds the values of the argument vector to the orignal vector. This functions the same as vector1 + vector2 without creating a new vector object, skipping object construction and garbage collection.

Arguments

1 Vector vector
The vector to add.

Example

Adds the components of the vectors together.

a = Vector(1, 1, 1) a:Add(Vector(1, 2, 3)) print(a)
Output: 2 3 4

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 add two vectors together. The original vector will remain unchanged.

a = Vector(1, 1, 1) print(a + Vector(1, 2, 3))
Output: 2 3 4

Page Links


Special Pages


Wikis

?

Render Time: 60ms

DB GetPage 40
Generate Html 2
SaveChanges (1) 9
Render Body 0
Render Sidebar 6