mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +00:00
Add named parameters to math
lib (#722)
Name the parameters used in `math` lib This is mainly done to highlight the particular confusion for `math.atan2`, where `y` comes before `x`, but this might not be immediately obvious. And then I added the rest of the names for consistency. Note: I didn't add names to `math.random` as it's currently typed as `(number?, number?) -> number`. Naming it `min` and `max` is technically incorrect for the 1 argument version. Maybe it should be typed as an intersection instead?
This commit is contained in:
parent
c4c120513f
commit
12ee1407a1
1 changed files with 29 additions and 29 deletions
|
@ -26,34 +26,34 @@ declare bit32: {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare math: {
|
declare math: {
|
||||||
frexp: (number) -> (number, number),
|
frexp: (n: number) -> (number, number),
|
||||||
ldexp: (number, number) -> number,
|
ldexp: (s: number, e: number) -> number,
|
||||||
fmod: (number, number) -> number,
|
fmod: (x: number, y: number) -> number,
|
||||||
modf: (number) -> (number, number),
|
modf: (n: number) -> (number, number),
|
||||||
pow: (number, number) -> number,
|
pow: (x: number, y: number) -> number,
|
||||||
exp: (number) -> number,
|
exp: (n: number) -> number,
|
||||||
|
|
||||||
ceil: (number) -> number,
|
ceil: (n: number) -> number,
|
||||||
floor: (number) -> number,
|
floor: (n: number) -> number,
|
||||||
abs: (number) -> number,
|
abs: (n: number) -> number,
|
||||||
sqrt: (number) -> number,
|
sqrt: (n: number) -> number,
|
||||||
|
|
||||||
log: (number, number?) -> number,
|
log: (n: number, base: number?) -> number,
|
||||||
log10: (number) -> number,
|
log10: (n: number) -> number,
|
||||||
|
|
||||||
rad: (number) -> number,
|
rad: (n: number) -> number,
|
||||||
deg: (number) -> number,
|
deg: (n: number) -> number,
|
||||||
|
|
||||||
sin: (number) -> number,
|
sin: (n: number) -> number,
|
||||||
cos: (number) -> number,
|
cos: (n: number) -> number,
|
||||||
tan: (number) -> number,
|
tan: (n: number) -> number,
|
||||||
sinh: (number) -> number,
|
sinh: (n: number) -> number,
|
||||||
cosh: (number) -> number,
|
cosh: (n: number) -> number,
|
||||||
tanh: (number) -> number,
|
tanh: (n: number) -> number,
|
||||||
atan: (number) -> number,
|
atan: (n: number) -> number,
|
||||||
acos: (number) -> number,
|
acos: (n: number) -> number,
|
||||||
asin: (number) -> number,
|
asin: (n: number) -> number,
|
||||||
atan2: (number, number) -> number,
|
atan2: (y: number, x: number) -> number,
|
||||||
|
|
||||||
min: (number, ...number) -> number,
|
min: (number, ...number) -> number,
|
||||||
max: (number, ...number) -> number,
|
max: (number, ...number) -> number,
|
||||||
|
@ -61,13 +61,13 @@ declare math: {
|
||||||
pi: number,
|
pi: number,
|
||||||
huge: number,
|
huge: number,
|
||||||
|
|
||||||
randomseed: (number) -> (),
|
randomseed: (seed: number) -> (),
|
||||||
random: (number?, number?) -> number,
|
random: (number?, number?) -> number,
|
||||||
|
|
||||||
sign: (number) -> number,
|
sign: (n: number) -> number,
|
||||||
clamp: (number, number, number) -> number,
|
clamp: (n: number, min: number, max: number) -> number,
|
||||||
noise: (number, number?, number?) -> number,
|
noise: (x: number, y: number?, z: number?) -> number,
|
||||||
round: (number) -> number,
|
round: (n: number) -> number,
|
||||||
}
|
}
|
||||||
|
|
||||||
type DateTypeArg = {
|
type DateTypeArg = {
|
||||||
|
|
Loading…
Reference in a new issue