Math Library: Difference between revisions
m (1 revision imported) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 08:02, 13 February 2023
Script Reference | Math Library |
Basic Math Functions
- Cos(x) - Cosine.
- ACos(x) - Arc Cosine.
- Sin(x) - Sin.
- ASin(x) - Arc Sin.
- Tan(x) - Tangent.
- ATan(x) - Arc Tangent.
- Ceil(x) - Smallest integer >= x.
- Floor(x) - Largest integer <= x.
- Round(x) - Rounds the number to the nearest integer whole number.
- Abs(x) - Absolute value of x.
- Clamp(x, min, max) - Clamps x to a minimum and maximum value.
- DegToRad(x) - Converts degrees to radians.
- RadToDeg(x) - Converts radians to degrees.
- Min(x, y) - Returns the minimum value of the 2 parameters.
- Max(x, y) - Returns the maximum value of the 2 parameters.
- RandInt(x, y) - Returns a random integer between x and y.
- RandFloat(x, y) - Returns a random float between x and y.
- RandRange(x, y) - same as RandFloat
- Sign(x) - Returns a signed scalar of x. Negative numbers returns -1, positive numbers return 1.
- Sqrt(x) - Square root of x. Returns integer if x is integer !
- SymmetricRandom() - Returns random number between -1.0 and 1.0
- UnitRandom() - Returns random number between 0.0 and 1.0
- ToBool(x) - Converts an integer, float or string to 0 or 1. Returns null if impossible. Valid string values are 0,1, false,true, off,on.
- ToFloat(x) - Converts an integer or string to a float. Returns 0.0 if impossible. Throws exception or returns the second parameter if x has wrong type.
- ToInt(x) - Converts a float or string to an integer. Returns 0 if impossible. Throws exception or returns the second parameter if x has wrong type.
- ToString(x) - Converts any value to a string.
- ToVector(x) - Converts a string to a Vector3. Returns 0.0 or the first parsed number if string can't be converted. Valid format is "x y z".
- IsBool(x) - same as IsInt
- IsEntity(x) - Returns true if x is entity handle
- IsFloat(x) - Returns true if x is floating-point number
- IsFloatOrInt(x) - Returns true if x is float or integer
- IsFunction(x) - Returns true if x is function
- IsInt(x) - Returns true if x is integer
- IsNull(x) - Returns true if x is null
- IsString(x) - Returns true if x is string
- IsTable(x) - Returns true if x is table
- IsVec3(x) - Returns true if x is Vector3