Difference between revisions of "Vector library"

From GiderosMobile
(Created page with "__NOTOC__ <!-- GIDEROSOBJ:vector --> '''Supported platforms:''' File:Platform android.pngFile:Platform ios.pngFile:Platform mac.pngFile:Platform pc.pngFile:P...")
 
Line 6: Line 6:
 
=== Description ===
 
=== Description ===
 
This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component.
 
This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component.
 +
 +
Individual vector components can be accessed using the fields x or X, y or Y, z or Z, and w or W in 4-wide mode. Since vector values are immutable, writes to individual components are not supported.
  
 
=== Reference ===
 
=== Reference ===
Line 13: Line 15:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
=== Methods ===
[[dofile]] ''executes as Lua chunk, default stdin, returns value''<br/><!--GIDEROSMTD:dofile(filename) executes as Lua chunk, default stdin, returns value-->
+
[[vector.zero]] ''constant vector with all components set to 0''<br/><!--GIDEROSMTD:vector.zero constant vector with all components set to 0-->
[[error]] ''terminates protected func, never returns''<br/><!--GIDEROSMTD:error(message,level) terminates protected func, never returns-->
+
[[vector.one]] ''constant vector with all components set to 1''<br/><!--GIDEROSMTD:vector.one constant vector with all components set to 1-->
  
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|

Revision as of 02:29, 1 February 2026

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform linux.png
Available since: Gideros 2026.1

Description

This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component.

Individual vector components can be accessed using the fields x or X, y or Y, z or Z, and w or W in 4-wide mode. Since vector values are immutable, writes to individual components are not supported.

Reference

https://luau.org/library/#vector-library

Methods

vector.zero constant vector with all components set to 0
vector.one constant vector with all components set to 1

Events

Constants