# vector.dot

Given two vectors, self and object, this function will multiply and add the components of object and self and output their dot product. If either argument does not follow Computercraft's vector style (a table with the contents: x, y, and z) the function will error.

 ExampleFind the dot product
Finds the dot product of two vectors
Code
```<nowiki>
local vectorA = vector.new(6, 7, -8)
local vectorB = vector.new(2, 3.2, 5)
local dotProduct = vector.dot(vectorA, vectorB) --12+22.4+(-40)
print("The dot product of my two vectors is:", dotProduct)
</nowiki>
```
Output The dot product of my two vectors is: -5.6
 ExampleBehind the scenes
An example of what the function looks like
Code
```<nowiki>
local vectorA = vector.new(6, 7, -8)
local vectorB = vector.new(2, 3.2, 5)
local dotProduct = (vectorA.x*vectorB.x)+(vectorA.y*vectorB.y)+(vectorA.z*vectorB.z)
print("The dot product of my two vectors is:", dotProduct)
</nowiki>
```
Output The dot product of my two vectors is: -5.6

vector.dot
Function
Syntax
vector.dot(
• self : table
• object : table
)
Colon notation: self:dot(
• object : table
)

Returns number dot product
API vector
Source CC:Tweaked (source)