Files
overextended.github.io/pages/ox_lib/Modules/Math/Shared.mdx
T
Jag 74227cc262 chore: oxmysql and ox_lib clean-up (#134)
* oxmysql and some lib interface fixes

- Various fixes throughout oxmysql
- started ox_lib audit

* chore: More clean up

- Reword some confusing descriptions
- Add some descriptions
- Type fixes
- Spelling and grammar fixes
- Swapping in `-` where `*` used to be for 
bullet point consistency

ox_lib
- Interface, ACL through GetClosestVehicle audited

* chore: Finishing up ox_lib
2023-07-03 13:13:56 +10:00

88 lines
1.3 KiB
Plaintext

## lib.math
Extends the standard Lua math table with extra functions.
```
math = lib.math
```
### math.toscalars
Takes a string and returns a set of scalar values.
```lua
math.toscalars(input, min, max, round)
```
- input: `string`
- min?: `number`
- max?: `number`
- round?: `boolean`
Return:
- ...: `number`
### math.tovector
Takes a string or table and returns a vector value, or a number if only one value was found.
```lua
math.tovector(input, min, max, round)
```
- input: `string` or `table`
- min?: `number`
- max?: `number`
- round?: `boolean`
Return:
- value: `number` or `vector2` or `vector3` or `vector4`
### math.torgba
Takes a string or table and returns a vector value, or a number if only one value was found.
Values are rounded and must be within the range of 0-255.
```lua
math.torgba(input)
```
- input: `string` or `table`
Return:
- value: `number` or `vector2` or `vector3` or `vector4`
### math.tohex
Takes a number or string and formats it as a hexadecimal string.
```lua
math.tohex(n, upper)
```
- n: `number` or `string`
- upper?: `boolean`
Return:
- hex: `string`
### math.groupdigits
Takes a number and formats it into grouped digits.
```lua
math.groupdigits(number, seperator)
```
- number: `number`
- seperator?: `string`
- Default: `,`
Return:
- groupedDigits: `string`