From c436f4a0018025641348a9124bedca8b229e4f74 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 25 Jul 2023 15:12:59 -0700 Subject: [PATCH] docs: Document return value for table.remove Fixes #984. --- docs/_pages/library.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_pages/library.md b/docs/_pages/library.md index 5e9ee088..d6d1bc7f 100644 --- a/docs/_pages/library.md +++ b/docs/_pages/library.md @@ -403,11 +403,12 @@ When using a two-argument version, appends the value to the array portion of the When using a three-argument version, inserts the value at index `i` and shifts values at indices after that by 1. `i` should be in `[1..#t]` range. ``` -function table.remove(t: {V}, i: number?) +function table.remove(t: {V}, i: number?): V? ``` Removes element `i` from the table and shifts values at indices after that by 1. If `i` is not specified, removes the last element of the table. `i` should be in `[1..#t]` range. +Returns the value of the removed element, or `nil` if no element was removed (e.g. table was empty). ``` function table.sort(t: {V}, f: ((V, V) -> boolean)?)