mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
rules
This commit is contained in:
parent
a9b4f8e83b
commit
e6efc04756
8494 changed files with 495610 additions and 0 deletions
726
.cursor/rules/roblox/reference/engine/libraries/math.yaml
Normal file
726
.cursor/rules/roblox/reference/engine/libraries/math.yaml
Normal file
|
|
@ -0,0 +1,726 @@
|
|||
# This file is automatically generated. Please don't edit it manually.
|
||||
# To submit a bug report on the content, see
|
||||
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
|
||||
|
||||
name: math
|
||||
type: library
|
||||
summary: |
|
||||
A library of math functions.
|
||||
description: |
|
||||
This library is an interface to the standard C math library, providing all of
|
||||
its functions inside the `Library.math` table.
|
||||
tags: []
|
||||
code_samples: []
|
||||
properties:
|
||||
- name: math.huge
|
||||
type: number
|
||||
summary: |
|
||||
Returns a value larger than or equal to any other numerical value (about
|
||||
2<sup>1024</sup>).
|
||||
description: |
|
||||
Returns a value larger than or equal to any other numerical value (about
|
||||
2<sup>1024</sup>). Dividing a positive number by zero yields this same
|
||||
value.
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.pi
|
||||
type: number
|
||||
summary: |
|
||||
The value of pi.
|
||||
description: |
|
||||
The value of pi.
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
functions:
|
||||
- name: math.abs
|
||||
summary: |
|
||||
Returns the absolute value of `x`.
|
||||
description: |
|
||||
Returns the absolute value of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.acos
|
||||
summary: |
|
||||
Returns the arc cosine of `x`.
|
||||
description: |
|
||||
Returns the arc cosine of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.asin
|
||||
summary: |
|
||||
Returns the arc sine of `x`.
|
||||
description: |
|
||||
Returns the arc sine of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.atan
|
||||
summary: |
|
||||
Returns the arc tangent of `x` in radians.
|
||||
description: |
|
||||
Returns the arc tangent of `x` in radians.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.atan2
|
||||
summary: |
|
||||
Returns the arc tangent of `y`/`x` (in radians) while using the signs of
|
||||
both parameters to find the quadrant of the result.
|
||||
description: |
|
||||
Returns the arc tangent of `y`/`x` (in radians) while using the signs of
|
||||
both parameters to find the quadrant of the result. It also handles
|
||||
correctly the case of `x` being zero.
|
||||
parameters:
|
||||
- name: 'y'
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.ceil
|
||||
summary: |
|
||||
Returns the smallest integer larger than or equal to `x`.
|
||||
description: |
|
||||
Returns the smallest integer larger than or equal to `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: int
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.clamp
|
||||
summary: |
|
||||
Returns a number between `min` and `max`, inclusive.
|
||||
description: |
|
||||
Returns a number between `min` and `max`, inclusive.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: min
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: max
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.cos
|
||||
summary: |
|
||||
Returns the cosine of `x`, assumed to be in radians.
|
||||
description: |
|
||||
Returns the cosine of `x`, assumed to be in radians.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.cosh
|
||||
summary: |
|
||||
Returns the hyperbolic cosine of `x`.
|
||||
description: |
|
||||
Returns the hyperbolic cosine of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.deg
|
||||
summary: |
|
||||
Returns the angle `x` (given in radians) in degrees.
|
||||
description: |
|
||||
Returns the angle `x` (given in radians) in degrees.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.exp
|
||||
summary: |
|
||||
Returns the value `e`^`x`.
|
||||
description: |
|
||||
Returns the value `e`^`x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.floor
|
||||
summary: |
|
||||
Returns the largest integer smaller than or equal to `x`.
|
||||
description: |
|
||||
Returns the largest integer smaller than or equal to `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: int
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.fmod
|
||||
summary: |
|
||||
Returns the remainder of the division of `x` by `y` that rounds the
|
||||
quotient towards zero.
|
||||
description: |
|
||||
Returns the remainder of the division of `x` by `y` that rounds the
|
||||
quotient towards zero.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: 'y'
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.frexp
|
||||
summary: |
|
||||
Returns `m` and `e` such that `x` = `m`\*`2`^`e`.
|
||||
description: |
|
||||
Returns `m` and `e` such that `x` = `m`\*`2`^`e`. `e` is an integer and
|
||||
the absolute value of `m` is in the range of `0.5` to `1` (inclusive of
|
||||
`0.5` but exclusive of `1`), or zero when `x` is zero.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
- type: int
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.ldexp
|
||||
summary: |
|
||||
Returns `x`\*`2`^`e` (`e` should be an integer).
|
||||
description: |
|
||||
Returns `x`\*`2`^`e` (`e` should be an integer).
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: e
|
||||
type: int
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.lerp
|
||||
summary: |
|
||||
Returns the linear interpolation between `a` and `b`.
|
||||
description: |
|
||||
Returns the linear interpolation between `a` and `b` based on the factor
|
||||
`t`.
|
||||
|
||||
This function uses the formula `a`+`(b-a)`\*`t`. `t` is typically between
|
||||
`0` and `1` but values outside this range are acceptable.
|
||||
parameters:
|
||||
- name: a
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The starting value.
|
||||
- name: b
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The ending value.
|
||||
- name: t
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The interpolation factor, typically between `0` and `1`.
|
||||
returns:
|
||||
- type: number
|
||||
summary: |
|
||||
The interpolated value between `a` and `b`.
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.log
|
||||
summary: |
|
||||
Returns the logarithm of `x` using the given base.
|
||||
description: |
|
||||
Returns the logarithm of `x` using the given base, or the mathematical
|
||||
constant `e` if no base is provided (natural logarithm).
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: base
|
||||
type: number
|
||||
default: 2.7182818
|
||||
summary: |
|
||||
The base of the logarithm, the constant `e` by default.
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.log10
|
||||
summary: |
|
||||
Returns the base-10 logarithm of `x`.
|
||||
description: |
|
||||
Returns the base-10 logarithm of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.map
|
||||
summary: |
|
||||
Returns the value of `x` mapped from one range to another.
|
||||
description: |
|
||||
Returns a value that represents `x` mapped linearly from the input range
|
||||
(`inmin` to `inmax`) to the output range (`outmin` to `outmax`). This is
|
||||
achieved by determining the relative position of `x` within the input
|
||||
range and applying that ratio to the output range.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The number to be mapped.
|
||||
- name: inmin
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The lower bound of the input range.
|
||||
- name: inmax
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The upper bound of the input range.
|
||||
- name: outmin
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The lower bound of the output range.
|
||||
- name: outmax
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The upper bound of the output range.
|
||||
returns:
|
||||
- type: number
|
||||
summary: |
|
||||
The value of `x` mapped to the output range.
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.max
|
||||
summary: |
|
||||
Returns the maximum value among the numbers passed to the function.
|
||||
description: |
|
||||
Returns the maximum value among the numbers passed to the function.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: ...
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.min
|
||||
summary: |
|
||||
Returns the minimum value among the numbers passed to the function.
|
||||
description: |
|
||||
Returns the minimum value among the numbers passed to the function.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: ...
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.modf
|
||||
summary: |
|
||||
Returns two numbers: the integral part of `x` and the fractional part of
|
||||
`x`.
|
||||
description: |
|
||||
Returns two numbers: the integral part of `x` and the fractional part of
|
||||
`x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.noise
|
||||
summary: |
|
||||
Returns a Perlin noise value.
|
||||
description: |
|
||||
Returns a Perlin noise value. The returned value is most often between the
|
||||
range of `-1` to `1` (inclusive) but sometimes may be outside that range;
|
||||
if the interval is critical to you, use `Library.math.clamp(noise, -1, 1)`
|
||||
on the output.
|
||||
|
||||
If you leave arguments out, they will be interpreted as zero, so
|
||||
`Library.math.noise(1.158)` is equivalent to
|
||||
`Library.math.noise(1.158, 0, 0)` and `Library.math.noise(1.158, 5.723)`
|
||||
is equivalent to `Library.math.noise(1.158, 5.723, 0)`.
|
||||
|
||||
Note that this function uses a Perlin noise algorithm to assign fixed
|
||||
values to coordinates. For example, `Library.math.noise(1.158, 5.723)`
|
||||
will always return `0.48397532105446` and `Library.math.noise(1.158, 6)`
|
||||
will always return `0.15315161645412`.
|
||||
|
||||
If `x`, `y`, and `z` are all integers, the return value will be `0`. For
|
||||
fractional values of `x`, `y`, and `z`, the return value will gradually
|
||||
fluctuate between `-0.5` and `0.5`. For coordinates that are close to each
|
||||
other, the return values will also be close to each other.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: 'y'
|
||||
type: number
|
||||
default: 0
|
||||
summary: ''
|
||||
- name: z
|
||||
type: number
|
||||
default: 0
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.pow
|
||||
summary: |
|
||||
Returns `x`^`y`.
|
||||
description: |
|
||||
Returns `x`^`y` (you can also use the expression `x`^`y` to compute this
|
||||
value).
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
- name: 'y'
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.rad
|
||||
summary: |
|
||||
Returns the angle `x` (given in degrees) in radians.
|
||||
description: |
|
||||
Returns the angle `x` (given in degrees) in radians.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.random
|
||||
summary: |
|
||||
Returns a random number within the range provided.
|
||||
description: |
|
||||
When called without arguments, returns a uniform pseudo-random real number
|
||||
in the range of `0` to `1` (inclusive of `0` but exclusive of `1`).
|
||||
|
||||
When called with an integer number `m`, returns a uniform pseudo-random
|
||||
integer in the range of `1` to `m`, inclusive.
|
||||
|
||||
When called with two integer numbers `m` and `n`, returns a uniform
|
||||
pseudo-random integer in the range of `m` to `n`, inclusive.
|
||||
|
||||
Internally, this uses a 32-bit PCG (Permuted Congruential Generator) which
|
||||
achieves excellent statistical performance and makes its output hard to
|
||||
predict.
|
||||
parameters:
|
||||
- name: m
|
||||
type: number
|
||||
default: 0
|
||||
summary: ''
|
||||
- name: 'n'
|
||||
type: number
|
||||
default: 1
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.randomseed
|
||||
summary: |
|
||||
Sets `x` as the seed for the pseudo-random generator.
|
||||
description: |
|
||||
Sets `x` as the seed for the pseudo-random generator: equal seeds produce
|
||||
equal sequences of numbers.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: ()
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.round
|
||||
summary: |
|
||||
Returns the integer with the smallest difference between it and the given
|
||||
number.
|
||||
description: |
|
||||
Returns the integer with the smallest difference between it and the given
|
||||
number. For example, the value `5.8` returns `6`.
|
||||
|
||||
For values like `0.5` that are equidistant to two integers, the value with
|
||||
the greater difference between it and zero is chosen. In other words, the
|
||||
function "rounds away from zero" such that `0.5` rounds to `1` and `-0.5`
|
||||
rounds to `-1`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: |
|
||||
The value to be rounded.
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.sign
|
||||
summary: |
|
||||
Returns `-1` if `x` is less than `0`, `0` if `x` equals `0`, or `1` if `x`
|
||||
is greater than `0`.
|
||||
description: |
|
||||
Returns `-1` if `x` is less than `0`, `0` if `x` equals `0`, or `1` if `x`
|
||||
is greater than `0`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: int
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.sin
|
||||
summary: |
|
||||
Returns the sine of `x`, assumed to be in radians.
|
||||
description: |
|
||||
Returns the sine of `x`, assumed to be in radians.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.sinh
|
||||
summary: |
|
||||
Returns the hyperbolic sine of `x`.
|
||||
description: |
|
||||
Returns the hyperbolic sine of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.sqrt
|
||||
summary: |
|
||||
Returns the square root of `x`.
|
||||
description: |
|
||||
Returns the square root of `x`. You can also use the expression `x`^`0.5`
|
||||
to compute this value.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.tan
|
||||
summary: |
|
||||
Returns the tangent of `x`, assumed to be in radians.
|
||||
description: |
|
||||
Returns the tangent of `x`, assumed to be in radians.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
- name: math.tanh
|
||||
summary: |
|
||||
Returns the hyperbolic tangent of `x`.
|
||||
description: |
|
||||
Returns the hyperbolic tangent of `x`.
|
||||
parameters:
|
||||
- name: x
|
||||
type: number
|
||||
default:
|
||||
summary: ''
|
||||
returns:
|
||||
- type: number
|
||||
summary: ''
|
||||
tags: []
|
||||
code_samples: []
|
||||
deprecation_message: ''
|
||||
Loading…
Add table
Add a link
Reference in a new issue