Difference between revisions of "Vector.new"

From ComputerCraft Wiki
Jump to: navigation, search
Line 1: Line 1:
Returns a table with the labels "x", "y" and "z" containing the coordinates of the vector.
+
{{lowercase}}
 
+
{{Function
local a = vector.new(1, 2, 3)
+
|name=vector.net
 +
|args=[[float (type)|float]] x, [[float (type)|float]] y, [[float (type)|float]] z
 +
|api=vector
 +
|addon=ComputerCraft
 +
|desc=Creates and returns a vector with the specified coordinates.
 +
|examples=
 +
{{Example
 +
|desc=Creates a vector and prints the components
 +
|code= local a = vector.new(1, 2, 3)
 
   
 
   
 
  print(a.x)
 
  print(a.x)
Line 9: Line 17:
 
  --2
 
  --2
 
  --3
 
  --3
 +
}}
 +
}}
 +
 +
[[Category:API_Functions]]

Revision as of 11:26, 23 February 2013


Grid Redstone.png  Function vector.net
Creates and returns a vector with the specified coordinates.
Syntax vector.net(float x, float y, float z)
Returns nil
Part of ComputerCraft
API vector

Examples

Grid paper.png  Example
Creates a vector and prints the components
Code
local a = vector.new(1, 2, 3)

print(a.x)
print(a.y)
print(a.z)
--1
--2
--3