vector.sub
Given two vectors, self and object, this function will subtract object from self to create a new vector. This can also be written as self - object
. If either argument was not created with vector.new, this function will not work as designed.
|
|||
Creates two new vectors then adds them together. | |||
Code | <nowiki>
local vectorA = vector.new(240, 71, -3040)
local vectorB = vector.new(2553, 32, -314)
local vectorC = vector.sub(vectorA, vectorB)
print("My new vector has the components:", vectorC.x, vectorC.y, vectorC.z)
</nowiki>
|
||
Output | My new vector has the components: -2313 39 -2726 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
vector.sub Function | |
---|---|
Syntax vector.sub(
Colon notation: self:sub(
| |
Returns | table vector |
API | vector |
Source | CC:Tweaked (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.