<?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%3Acompare</id>
	<title>Module:compare - 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%3Acompare"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:compare&amp;action=history"/>
	<updated>2026-04-06T05:06:33Z</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:compare&amp;diff=474933&amp;oldid=prev</id>
		<title>Sware: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:compare&amp;diff=474933&amp;oldid=prev"/>
		<updated>2025-11-04T17:47:21Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:47, 4 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:compare&amp;diff=474932&amp;oldid=prev</id>
		<title>wikt&gt;Theknightwho: Protected &quot;Module:compare&quot;: Highly visible template/module ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:compare&amp;diff=474932&amp;oldid=prev"/>
		<updated>2025-05-07T01:35:20Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/wiki/Module:compare&quot; title=&quot;Module:compare&quot;&gt;Module:compare&lt;/a&gt;&amp;quot;: Highly visible template/module ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local math_compare_module = &amp;quot;Module:math/compare&amp;quot;&lt;br /&gt;
local string_compare_module = &amp;quot;Module:string/compare&amp;quot;&lt;br /&gt;
local table_compare_module = &amp;quot;Module:table/compare&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local require = require&lt;br /&gt;
local type = type&lt;br /&gt;
&lt;br /&gt;
local types&lt;br /&gt;
local function get_types()&lt;br /&gt;
	types, get_types = {&lt;br /&gt;
		[&amp;quot;nil&amp;quot;] = &amp;quot;\1&amp;quot;,&lt;br /&gt;
		[&amp;quot;boolean&amp;quot;] = &amp;quot;\2&amp;quot;,&lt;br /&gt;
		[&amp;quot;number&amp;quot;] = &amp;quot;\3&amp;quot;,&lt;br /&gt;
		[&amp;quot;string&amp;quot;] = &amp;quot;\4&amp;quot;,&lt;br /&gt;
	}, nil&lt;br /&gt;
	return types&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local compare_funcs&lt;br /&gt;
local function get_compare_funcs()&lt;br /&gt;
	compare_funcs = {}&lt;br /&gt;
	&lt;br /&gt;
	function compare_funcs.boolean(a, b)&lt;br /&gt;
		return a == true and b == false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	function compare_funcs.number(...)&lt;br /&gt;
		local math_compare = require(math_compare_module)&lt;br /&gt;
		compare_funcs.number = math_compare&lt;br /&gt;
		return math_compare(...)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function compare_funcs.string(...)&lt;br /&gt;
		local string_compare = require(string_compare_module)&lt;br /&gt;
		compare_funcs.string = string_compare&lt;br /&gt;
		return string_compare(...)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function compare_funcs.table(...)&lt;br /&gt;
		local table_compare = require(table_compare_module)&lt;br /&gt;
		compare_funcs.table = table_compare&lt;br /&gt;
		return table_compare(...)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	get_compare_funcs = nil&lt;br /&gt;
	return compare_funcs&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
A general comparison function, which returns {true} if {a} sorts before {b}, or otherwise {false}; it can be used as the sort function with {table.sort}.&lt;br /&gt;
&lt;br /&gt;
This function is roughly equivalent to the {&amp;lt;} operator, but is capable of comparing a mix of types, using the following rules:&lt;br /&gt;
* When items of different types are compared, the type-order is {&amp;quot;nil&amp;quot;}, {&amp;quot;boolean&amp;quot;}, {&amp;quot;number&amp;quot;}, {&amp;quot;string&amp;quot;}, then alphabetical order by type name for all other types.&lt;br /&gt;
* Numbers are compared with [[Module:math/compare]].&lt;br /&gt;
* Strings are compared with [[Module:string/compare]].&lt;br /&gt;
* Tables are compared with [[Module:table/compare]].&lt;br /&gt;
* Boolean {true} sorts before {false}.&lt;br /&gt;
* All other types always return {false}.]==]&lt;br /&gt;
return function(a, b)&lt;br /&gt;
	local type_a, type_b = type(a), type(b)&lt;br /&gt;
	if type_a == type_b then&lt;br /&gt;
		local func = (compare_funcs or get_compare_funcs())[type_a]&lt;br /&gt;
		return func and func(a, b) or false&lt;br /&gt;
	end&lt;br /&gt;
	return ((types or get_types())[type_a] or type_a) &amp;lt; (types[type_b] or type_b)&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>wikt&gt;Theknightwho</name></author>
	</entry>
</feed>