mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 21:40:43 +00:00
docs: Add deprecation notice to getn/foreach/foreachi (#849)
RFC: https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md
This commit is contained in:
parent
d2ab5df62b
commit
aef99ae0d4
1 changed files with 3 additions and 3 deletions
|
@ -374,19 +374,19 @@ Concatenate all elements of `a` with indices in range `[f..t]` together, using `
|
||||||
function table.foreach<K, V, R>(t: { [K]: V }, f: (K, V) -> R?): R?
|
function table.foreach<K, V, R>(t: { [K]: V }, f: (K, V) -> R?): R?
|
||||||
```
|
```
|
||||||
|
|
||||||
Iterates over all elements of the table in unspecified order; for each key-value pair, calls `f` and returns the result of `f` if it's non-nil. If all invocations of `f` returned `nil`, returns no values.
|
Iterates over all elements of the table in unspecified order; for each key-value pair, calls `f` and returns the result of `f` if it's non-nil. If all invocations of `f` returned `nil`, returns no values. This function has been deprecated and is not recommended for use in new code; use `for` loop instead.
|
||||||
|
|
||||||
```
|
```
|
||||||
function table.foreachi<V, R>(t: {V}, f: (number, V) -> R?): R?
|
function table.foreachi<V, R>(t: {V}, f: (number, V) -> R?): R?
|
||||||
```
|
```
|
||||||
|
|
||||||
Iterates over numeric keys of the table in `[1..#t]` range in order; for each key-value pair, calls `f` and returns the result of `f` if it's non-nil. If all invocations of `f` returned `nil`, returns no values.
|
Iterates over numeric keys of the table in `[1..#t]` range in order; for each key-value pair, calls `f` and returns the result of `f` if it's non-nil. If all invocations of `f` returned `nil`, returns no values. This function has been deprecated and is not recommended for use in new code; use `for` loop instead.
|
||||||
|
|
||||||
```
|
```
|
||||||
function table.getn<V>(t: {V}): number
|
function table.getn<V>(t: {V}): number
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns the length of table `t` (equivalent to `#t`).
|
Returns the length of table `t`. This function has been deprecated and is not recommended for use in new code; use `#t` instead.
|
||||||
|
|
||||||
```
|
```
|
||||||
function table.maxn<V>(t: {V}): number
|
function table.maxn<V>(t: {V}): number
|
||||||
|
|
Loading…
Reference in a new issue