File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ assert(table.contains(t, "nothing") == nil)
7272```
7373---
7474### ` table.find `
75- Looks for an element in a table .
75+ Search a table for an element, returning its value .
7676#### Parameters
77771 . The table to check.
78782 . The callback function responsible for checking each element.
@@ -87,6 +87,19 @@ local items = {
8787print(items:find(|item| -> item.id == 1).name) --> Apple
8888```
8989---
90+ ### ` table.findkey ` , ` table.findindex `
91+ Search a table for an element, returning its key/index.
92+ #### Parameters
93+ 1 . The table to check.
94+ 2 . The callback function responsible for checking each element.
95+ #### Returns
96+ The key/index if found, otherwise ` nil ` .
97+ ``` pluto
98+ local fruit = { "apple", "banana", "orange" }
99+ print(fruit:findkey(|x| -> x == "banana")) --> 2
100+ print(fruit[2]) --> banana
101+ ````
102+ ---
90103### `table.reverse`
91104Reverses the array elements of a table.
92105#### Parameters
You can’t perform that action at this time.
0 commit comments