Difference between revisions of "VectorA:mul"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "Returns a multiplication of the vector by a scalar local a = vector.new(1, 2, 3) local b = 2.5 local c = a:mul(b) print(c.x) print(c.y) print(c.z) --2.5 --5 --7.5")
 
Line 1: Line 1:
Returns a multiplication of the vector by a scalar
+
Returns the multiplication of the vector by a scalar
  
 +
Code representation:
 +
local a = vector.new(1, 2, 3)
 +
local b = 2
 +
 +
local c = vector.new((a.x * b), (a.y * b), (a.z * b))
 +
--c.x = 2
 +
--c.y = 4
 +
--c.z = 6
 +
 +
 +
Code example:
 
  local a = vector.new(1, 2, 3)
 
  local a = vector.new(1, 2, 3)
 
  local b = 2.5
 
  local b = 2.5

Revision as of 09:59, 23 February 2013

Returns the multiplication of the vector by a scalar

Code representation:

local a = vector.new(1, 2, 3)
local b = 2

local c = vector.new((a.x * b), (a.y * b), (a.z * b))
--c.x = 2
--c.y = 4
--c.z = 6


Code example:

local a = vector.new(1, 2, 3)
local b = 2.5

local c = a:mul(b)

print(c.x)
print(c.y)
print(c.z)
--2.5
--5
--7.5