Skip to content

Commit

Permalink
Add Luau vector library (#624)
Browse files Browse the repository at this point in the history
Adds vector library to Luau standard library

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

---------

Co-authored-by: boyned//Kampfkarren <[email protected]>
  • Loading branch information
FeudalDiana and Kampfkarren authored Jan 10, 2025
1 parent fdb2939 commit b9a345b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Added `Path2DControlPoint.new`, `Content.fromUri`, `Content.fromAssetId`, and `Content.fromObject` to the Roblox standard library
- [Adds `lua_versions` to standard library definitions](https://kampfkarren.github.io/selene/usage/std.html#lua_versions). Specifying this will only allow the syntax used by those languages. The default standard libraries now specify these, meaning that invalid syntax for that language will no longer be supported.
- Added missing third parameter to `PathWaypoint.new` in the Roblox standard library
- Added `vector` library to Luau standard library
- Added `math.map` to the Luau standard library

### Changed
Expand Down Expand Up @@ -443,4 +444,4 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Added standard library chaining. This means you can combine two standard libraries by setting `std` in selene.toml to `std1+std2`. You can chain as many as you want.

## [0.1.0](https://github.com/Kampfkarren/selene/releases/tag/0.1.0) - 2019-11-06
- Initial release
- Initial release
87 changes: 87 additions & 0 deletions selene-lib/default_std/luau.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,90 @@ globals:
- required: false
type: number
must_use: true
vector.abs:
args:
- type:
display: vector
must_use: true
vector.angle:
args:
- type:
display: vector
- type:
display: vector
- required: false
type:
display: vector
must_use: true
vector.ceil:
args:
- type:
display: vector
must_use: true
vector.clamp:
args:
- type:
display: vector
- type:
display: vector
- type:
display: vector
must_use: true
vector.create:
args:
- type: number
- type: number
- type: number
must_use: true
vector.cross:
args:
- type:
display: vector
- type:
display: vector
must_use: true
vector.dot:
args:
- type:
display: vector
- type:
display: vector
must_use: true
vector.floor:
args:
- type:
display: vector
must_use: true
vector.magnitude:
args:
- type:
display: vector
must_use: true
vector.max:
args:
- type:
display: vector
- type: "..."
required: false
must_use: true
vector.min:
args:
- type:
display: vector
- type: "..."
required: false
must_use: true
vector.normalize:
args:
- type:
display: vector
must_use: true
vector.one:
property: read-only
vector.sign:
args:
- type:
display: vector
must_use: true
vector.zero:
property: read-only

0 comments on commit b9a345b

Please sign in to comment.