Difference between revisions of "VectorA:add"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "Returns the result of the two vectors local a = vector.new(1, 2, 3) local b = vector.new(4, 5, 6) local c = a:add(b) print(c.x) print(c.y) print(c.z) --5 --7 --9")
 
Line 1: Line 1:
Returns the result of the two vectors
+
{{lowercase}}
 
+
{{Function
local a = vector.new(1, 2, 3)
+
|name=vector:add
 +
|args=[[vector (API)|vector]] vect
 +
|returns=[[vector (API)|vector]]
 +
|api=vector
 +
|addon=ComputerCraft
 +
|desc=Returns the result of two vectors
 +
|examples=
 +
{{Example
 +
|desc=Creates two vectors, adds them, and then prints the resulting vector
 +
|code=local a = vector.new(1, 2, 3)
 
  local b = vector.new(4, 5, 6)
 
  local b = vector.new(4, 5, 6)
 
   
 
   
Line 12: Line 21:
 
  --7
 
  --7
 
  --9
 
  --9
 +
}}
 +
}}
 +
 +
[[Category:API_Functions]]

Revision as of 11:36, 23 February 2013


Grid Redstone.png  Function vector:add
Returns the result of two vectors
Syntax vector:add(vector vect)
Returns vector
Part of ComputerCraft
API vector

Examples

Grid paper.png  Example
Creates two vectors, adds them, and then prints the resulting vector
Code
local a = vector.new(1, 2, 3)
local b = vector.new(4, 5, 6)

local c = a:add(b)

print(c.x)
print(c.y)
print(c.z)
--5
--7
--9