Given a vector, self, and a scalar this function will multiply each component in self by the scalar to create a new vector. This can also be written as self * scalar. If self was not created with, this function will not work as designed.

ExampleMultiply a vector
Multiples a vector by a number.
local vectorA =, 71, -3040)
local vectorB = vector.mul(vectorA, 2)
print("My new vector has the components:", vectorB.x, vectorB.y, vectorB.z)
Output My new vector has the components: 480 142 -6080

  • self : table
  • scalar : number
Colon notation: self:mul(
  • scalar : number

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.