vector.unm
Given a vector, self, this function will apply the unary operation, unary minus, to each component in self to create a new vector. This can also be written as -self
. If self was not created with vector.new, this function will not work as designed.
|
|||
Applies unary minus to a vector and prints the resulting vector | |||
Code | <nowiki>
local vectorA = vector.new(240, 71, -3040)
local vectorB = vector.unm(vectorA)
print("My new vector has the components:", vectorB.x, vectorB.y, vectorB.z)
</nowiki>
|
||
Output | My new vector has the components: -240 -71 3040 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
vector.unm Function | |
---|---|
Syntax vector.unm(
Colon notation: self:unm() | |
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.