Difference between revisions of "VectorA:add"
From ComputerCraft Wiki
(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") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | {{lowercase}} | |
| − | + | {{Function | |
| − | + | |name=vector:add | |
| + | |args=[[vector (API)|vector]] vect | ||
| + | |returns=[[vector (API)|vector]] | ||
| + | |api=vector | ||
| + | |addon=ComputerCraft | ||
| + | |desc=Adds the two vectors and returns the resulting vector. | ||
| + | |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) | ||
local c = a:add(b) | local c = a:add(b) | ||
| + | --local c = a + b | ||
print(c.x) | print(c.x) | ||
| Line 12: | Line 22: | ||
--7 | --7 | ||
--9 | --9 | ||
| + | }} | ||
| + | }} | ||
| + | |||
| + | [[Category:API_Functions]] | ||
Latest revision as of 11:58, 23 February 2013
| Adds the two vectors and returns the resulting vector. | |
| Syntax | vector:add(vector vect) |
| Returns | vector |
| Part of | ComputerCraft |
| API | vector |