Skip to content

Commit aec0df2

Browse files
authored
Added missing library functions (#51)
1 parent 53914ef commit aec0df2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

_pages/library.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ function math.lerp(a: number, b: number, t: number): number
257257
Linearly interpolated between number value `a` and `b` using factor `t`, generally returning the result of `a + (b - a) * t`.
258258
When `t` is exactly `1`, the value of `b` will be returned instead to ensure that when `t` is on the interval `[0, 1]`, the result of `lerp` will be on the interval `[a, b]`.
259259

260+
```
261+
math.map(x: number, inmin: number, inmax: number, outmin: number, outmax: number): number
262+
```
263+
264+
Returns a value that represents `x` mapped linearly from the input range (`inmin` to `inmax`) to the output range (`outmin` to `outmax`).
265+
260266
```
261267
function math.log10(n: number): number
262268
```
@@ -951,6 +957,22 @@ If an optional 'count' is specified, only 'count' bytes are taken from the strin
951957

952958
Count cannot be larger than the string length.
953959

960+
```
961+
buffer.readbits(b: buffer, bitOffset: number, bitCount: number): number
962+
```
963+
964+
Used to read a range of `bitCount` bits from the buffer, at specified offset `bitOffset`, into an unsigned integer.
965+
966+
`bitCount` must be in `[0, 32]` range.
967+
968+
```
969+
buffer.writebits(b: buffer, bitOffset: number, bitCount: number, value: number): ()
970+
```
971+
972+
Used to write `bitCount` bits from `value` into the buffer at specified offset `bitOffset`.
973+
974+
`bitCount` must be in `[0, 32]` range.
975+
954976
```
955977
function buffer.copy(target: buffer, targetOffset: number, source: buffer, sourceOffset: number?, count: number?): ()
956978
```

0 commit comments

Comments
 (0)