Garry's Mod Wiki

Revision Difference

Vector#517129

List of all possible functions to manipulate vectors. Created by <page>Global.Vector</page>. <classfields> <fields>{{ClassField|number|**x** or **1**|The X component of the vector.</fields>⤶ <fields>⤶ <item name="**x** or **1**" type="number">The X component of the vector.</item>⤶ ⤶ <item name="**y** or **2**" type="number">The Y component of the vector.</item>⤶ ⤶ <item name="**z** or **3**" type="number">The Z component of the vector.</item>⤶ </fields>⤶ </classfields> {{ClassField|number|**y** or **2**|The Y component of the vector.}}⤶ {{ClassField|number|**z** or **3**|The Z component of the vector.}}⤶ }}⤶ <example> <description>Indexing by named component.</description> <code> local v = Vector( 1, 2, 3 ) print( v.x, v.y, v.z ) </code> <output>1 2 3</output> </example> <example> <description>Indexing by number (most efficient!).</description> <code> local v = Vector( 1, 2, 3 ) print( v[1], v[2], v[3] ) </code> <output>1 2 3</output> </example>