vector.new
Given three coordinates, x, y, and z, this function will create a new vector when called. If an argument is not a number and cannot be converted to a number the corresponding coordinate will default to zero.
|
|||
| Creates a new vector and prints the components. | |||
| Code | <nowiki>
local myVector = vector.new(240, 71, -3040)
print("My vector has the components:", myVector.x, myVector.y, myVector.z)
</nowiki>
|
||
| Output | My vector has the components: 240 71 -3040 | ||
|
|||
| Acquiring the executing computer's own location and printing it on screen. | |||
| Code | <nowiki>
local location = vector.new(gps.locate())
print("Current location is:", location)
</nowiki>
|
||
| Output | Current location is: 38 65 392 | ||
| vector.new Function | |
|---|---|
|
Syntax vector.new(
| |
| 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.