From aef99ae0d42e2cf6c81455d76a3ec3114b7c0498 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 27 Feb 2023 12:30:23 -0800 Subject: [PATCH] docs: Add deprecation notice to getn/foreach/foreachi (#849) RFC: https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md --- docs/_pages/library.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_pages/library.md b/docs/_pages/library.md index 2939f930..5e9ee088 100644 --- a/docs/_pages/library.md +++ b/docs/_pages/library.md @@ -374,19 +374,19 @@ Concatenate all elements of `a` with indices in range `[f..t]` together, using ` function table.foreach(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(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(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(t: {V}): number