<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Atable%2Ffind</id>
	<title>Module:table/find - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Atable%2Ffind"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/find&amp;action=history"/>
	<updated>2026-04-04T08:48:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:table/find&amp;diff=488017&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local table_deep_equals_module = &quot;Module:table/deepEquals&quot;  local deep_equals local function get_deep_equals() 	deep_equals, get_deep_equals = require(table_deep_equals_module), nil 	return deep_equals end  local function equality_op(a, b) 	return a == b end  --[==[ Given a list and a value to be found, returns the value&#039;s index if the value is in the array portion of the list, or {nil} if not found.  `options` is an optional table of additional options to control the be...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/find&amp;diff=488017&amp;oldid=prev"/>
		<updated>2026-02-16T18:16:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local table_deep_equals_module = &amp;quot;Module:table/deepEquals&amp;quot;  local deep_equals local function get_deep_equals() 	deep_equals, get_deep_equals = require(table_deep_equals_module), nil 	return deep_equals end  local function equality_op(a, b) 	return a == b end  --[==[ Given a list and a value to be found, returns the value&amp;#039;s index if the value is in the array portion of the list, or {nil} if not found.  `options` is an optional table of additional options to control the be...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local table_deep_equals_module = &amp;quot;Module:table/deepEquals&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local deep_equals&lt;br /&gt;
local function get_deep_equals()&lt;br /&gt;
	deep_equals, get_deep_equals = require(table_deep_equals_module), nil&lt;br /&gt;
	return deep_equals&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function equality_op(a, b)&lt;br /&gt;
	return a == b&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Given a list and a value to be found, returns the value&amp;#039;s index if the value is in the array portion of the list, or {nil} if not found.&lt;br /&gt;
&lt;br /&gt;
`options` is an optional table of additional options to control the behavior of the operation. The following options are recognized:&lt;br /&gt;
* `comparison`: Function of two arguments to compare whether `item` will be deemed equal to an existing item in `list`. If unspecified, items are deemed equal if {deepEquals} returns {true} (which is always the case if the equality operator {==} would return true). As a special case, if the string value {&amp;quot;==&amp;quot;} is specified, then the equality operator alone will be used.&lt;br /&gt;
* `key`: Function of one argument to return a comparison key, which will be used with the comparison function. The key function is applied to both `item` and the existing item in `list` to compare against, and the comparison is done against the results.]==]&lt;br /&gt;
return function(list, x, options)&lt;br /&gt;
	local i, key_func, comp_func = 1&lt;br /&gt;
	if options == nil then&lt;br /&gt;
		comp_func = deep_equals or get_deep_equals()&lt;br /&gt;
	else&lt;br /&gt;
		key_func, comp_func = options.key, options.comparison&lt;br /&gt;
		if key_func ~= nil then&lt;br /&gt;
			x = key_func(x)&lt;br /&gt;
		end&lt;br /&gt;
		if comp_func == nil then&lt;br /&gt;
			comp_func = deep_equals or get_deep_equals()&lt;br /&gt;
		elseif comp_func == &amp;quot;==&amp;quot; then&lt;br /&gt;
			comp_func = equality_op&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	while true do&lt;br /&gt;
		local v = list[i]&lt;br /&gt;
		if v == nil then&lt;br /&gt;
			return nil&lt;br /&gt;
		elseif key_func ~= nil then&lt;br /&gt;
			v = key_func(v)&lt;br /&gt;
		end&lt;br /&gt;
		if comp_func(v, x) then&lt;br /&gt;
			return i&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>