<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://test.st34an.tech/index.php?action=history&amp;feed=atom&amp;title=Module%3ATable</id>
	<title>Module:Table - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://test.st34an.tech/index.php?action=history&amp;feed=atom&amp;title=Module%3ATable"/>
	<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Table&amp;action=history"/>
	<updated>2026-04-10T18:59:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://test.st34an.tech/index.php?title=Module:Table&amp;diff=37&amp;oldid=prev</id>
		<title>Jsrs701: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Table&amp;diff=37&amp;oldid=prev"/>
		<updated>2026-04-10T07:25:49Z</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;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:25, 10 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&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;!-- diff cache key mediawikidb:diff:1.41:old-36:rev-37 --&gt;
&lt;/table&gt;</summary>
		<author><name>Jsrs701</name></author>
	</entry>
	<entry>
		<id>https://test.st34an.tech/index.php?title=Module:Table&amp;diff=36&amp;oldid=prev</id>
		<title>bob&gt;Vaxjedi at 04:12, 17 October 2023</title>
		<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Table&amp;diff=36&amp;oldid=prev"/>
		<updated>2023-10-17T04:12:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--                      table (formerly TableTools)                               --&lt;br /&gt;
--                                                                                --&lt;br /&gt;
-- This module includes a number of functions for dealing with Lua tables.        --&lt;br /&gt;
-- It is a meta-module, meant to be called from other Lua modules, and should     --&lt;br /&gt;
-- not be called directly from #invoke.                                           --&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Inserting new values into a table using a local &amp;quot;index&amp;quot; variable, which is&lt;br /&gt;
	incremented each time, is faster than using &amp;quot;table.insert(t, x)&amp;quot; or&lt;br /&gt;
	&amp;quot;t[#t + 1] = x&amp;quot;. See the talk page.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local libraryUtil = require(&amp;#039;libraryUtil&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local export = {}&lt;br /&gt;
&lt;br /&gt;
-- Define often-used variables and functions.&lt;br /&gt;
local floor = math.floor&lt;br /&gt;
local infinity = math.huge&lt;br /&gt;
local checkType = libraryUtil.checkType&lt;br /&gt;
local checkTypeMulti = libraryUtil.checkTypeMulti&lt;br /&gt;
&lt;br /&gt;
local function _check(funcName, expectType)&lt;br /&gt;
	if type(expectType) == &amp;quot;string&amp;quot; then&lt;br /&gt;
		return function(argIndex, arg, nilOk)&lt;br /&gt;
			checkType(funcName, argIndex, arg, expectType, nilOk)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return function(argIndex, arg, expectType, nilOk)&lt;br /&gt;
			if type(expectType) == &amp;quot;table&amp;quot; then&lt;br /&gt;
				checkTypeMulti(funcName, argIndex, arg, expectType, nilOk)&lt;br /&gt;
			else&lt;br /&gt;
				checkType(funcName, argIndex, arg, expectType, nilOk)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- isPositiveInteger&lt;br /&gt;
--&lt;br /&gt;
-- This function returns true if the given value is a positive integer, and false&lt;br /&gt;
-- if not. Although it doesn&amp;#039;t operate on tables, it is included here as it is&lt;br /&gt;
-- useful for determining whether a given table key is in the array part or the&lt;br /&gt;
-- hash part of a table.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.isPositiveInteger(v)&lt;br /&gt;
	return type(v) == &amp;#039;number&amp;#039; and v &amp;gt;= 1 and floor(v) == v and v &amp;lt; infinity&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- isNan&lt;br /&gt;
--&lt;br /&gt;
-- This function returns true if the given number is a NaN value, and false&lt;br /&gt;
-- if not. Although it doesn&amp;#039;t operate on tables, it is included here as it is&lt;br /&gt;
-- useful for determining whether a value can be a valid table key. Lua will&lt;br /&gt;
-- generate an error if a NaN is used as a table key.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.isNan(v)&lt;br /&gt;
	if type(v) == &amp;#039;number&amp;#039; and tostring(v) == &amp;#039;-nan&amp;#039; then&lt;br /&gt;
		return true&lt;br /&gt;
	else&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- shallowcopy&lt;br /&gt;
--&lt;br /&gt;
-- This returns a clone of an object. If the object is a table, the value&lt;br /&gt;
-- returned is a new table, but all subtables and functions are shared.&lt;br /&gt;
-- Metamethods are respected, but the returned table will have no metatable of&lt;br /&gt;
-- its own.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.shallowcopy(orig)&lt;br /&gt;
	local orig_type = type(orig)&lt;br /&gt;
	local copy&lt;br /&gt;
	if orig_type == &amp;#039;table&amp;#039; then&lt;br /&gt;
		copy = {}&lt;br /&gt;
		for orig_key, orig_value in pairs(orig) do&lt;br /&gt;
			copy[orig_key] = orig_value&lt;br /&gt;
		end&lt;br /&gt;
	else -- number, string, boolean, etc&lt;br /&gt;
		copy = orig&lt;br /&gt;
	end&lt;br /&gt;
	return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- An alias for shallowcopy(); prefer shallowcopy().&lt;br /&gt;
function export.shallowClone(t)&lt;br /&gt;
	return export.shallowcopy(t)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- deepcopy&lt;br /&gt;
--&lt;br /&gt;
-- Recursive deep copy function. Preserves copied identities of subtables.&lt;br /&gt;
-- A more powerful version of mw.clone, as it is able to clone recursive tables without getting into an infinite loop.&lt;br /&gt;
-- NOTE: protected metatables will not be copied (i.e. those hidden behind a __metatable metamethod), as they are not accessible by Lua&amp;#039;s design. Instead, the output of the __metatable method will be used instead.&lt;br /&gt;
-- An exception is made for data loaded via mw.loadData, which has its metatable stripped by default. This is because it has a protected metatable, and the substitute metatable causes behaviour that is generally unwanted. This exception can be overridden by setting `rawCopy` to true.&lt;br /&gt;
-- If `noMetatable` is true, then metatables will not be present in the copy at all.&lt;br /&gt;
-- If `keepLoadedData` is true, then any data loaded via mw.loadData will not be copied, and the original will be used instead. This is useful in iterative contexts where it is necessary to copy data being destructively modified, because objects loaded via mw.loadData are immutable.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
function export.deepcopy(orig, noMetatable, rawCopy, keepLoadedData)&lt;br /&gt;
	local already_seen = {}&lt;br /&gt;
	&lt;br /&gt;
	local function dc(orig, includeMetatable)&lt;br /&gt;
		if keepLoadedData then&lt;br /&gt;
			local mt = getmetatable(orig)&lt;br /&gt;
			if mt and mt.mw_loadData then&lt;br /&gt;
				return orig&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if type(orig) == &amp;quot;table&amp;quot; then&lt;br /&gt;
			if not already_seen[orig] then&lt;br /&gt;
				local copy = {}&lt;br /&gt;
				already_seen[orig] = copy&lt;br /&gt;
				for key, value in pairs(orig) do&lt;br /&gt;
					copy[dc(key, includeMetatable)] = dc(value, includeMetatable)&lt;br /&gt;
				end&lt;br /&gt;
				if includeMetatable then&lt;br /&gt;
					local mt = getmetatable(orig)&lt;br /&gt;
					if type(mt) == &amp;quot;table&amp;quot; and (&lt;br /&gt;
						(not mt.mw_loadData) or&lt;br /&gt;
						(mt.mw_loadData and rawCopy)&lt;br /&gt;
					) then &lt;br /&gt;
						setmetatable(copy, dc(mt, includeMetatable))&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return already_seen[orig]&lt;br /&gt;
		else&lt;br /&gt;
			return orig&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return dc(orig, not noMetatable)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- append&lt;br /&gt;
--&lt;br /&gt;
-- This appends any number of tables together and returns the result. Compare the Lisp&lt;br /&gt;
-- expression (append list1 list2 ...).&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.append(...)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for i=1,select(&amp;#039;#&amp;#039;, ...) do&lt;br /&gt;
		local argt = select(i, ...)&lt;br /&gt;
		checkType(&amp;#039;append&amp;#039;, i, argt, &amp;#039;table&amp;#039;)&lt;br /&gt;
		for _, v in ipairs(argt) do&lt;br /&gt;
			table.insert(ret, v)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- extendList&lt;br /&gt;
--&lt;br /&gt;
-- Extend an existing list by a new list, modifying the existing list in-place.&lt;br /&gt;
-- Compare the Python expression list.extend(new_items). If `insertIfNot` is specified,&lt;br /&gt;
-- insertion uses export.insertIfNot() instead of table.insert(), which ensures that&lt;br /&gt;
-- duplicate items do not get inserted (at the cost of an M*N operation, where&lt;br /&gt;
-- M = #list and N = #new_items).&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.extendList(list, new_items, insertIfNOt)&lt;br /&gt;
	checkType(&amp;#039;extendList&amp;#039;, 1, list, &amp;#039;table&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;extendList&amp;#039;, 2, new_items, &amp;#039;table&amp;#039;)&lt;br /&gt;
	for _, item in ipairs(new_items) do&lt;br /&gt;
		if insertIfNot then&lt;br /&gt;
			export.insertIfNot(list, item)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(list, item)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- removeDuplicates&lt;br /&gt;
--&lt;br /&gt;
-- This removes duplicate values from an array. Non-positive-integer keys are&lt;br /&gt;
-- ignored. The earliest value is kept, and all subsequent duplicate values are&lt;br /&gt;
-- removed, but otherwise the array order is unchanged.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.removeDuplicates(t)&lt;br /&gt;
	checkType(&amp;#039;removeDuplicates&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	local isNan = export.isNan&lt;br /&gt;
	local ret, exists = {}, {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	for _, v in ipairs(t) do&lt;br /&gt;
		if isNan(v) then&lt;br /&gt;
			-- NaNs can&amp;#039;t be table keys, and they are also unique, so we don&amp;#039;t need to check existence.&lt;br /&gt;
			ret[index] = v&lt;br /&gt;
			index = index + 1&lt;br /&gt;
		else&lt;br /&gt;
			if not exists[v] then&lt;br /&gt;
				ret[index] = v&lt;br /&gt;
				index = index + 1&lt;br /&gt;
				exists[v] = true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- numKeys&lt;br /&gt;
--&lt;br /&gt;
-- This takes a table and returns an array containing the numbers of any numerical&lt;br /&gt;
-- keys that have non-nil values, sorted in numerical order.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.numKeys(t, checked)&lt;br /&gt;
	if not checked then&lt;br /&gt;
		checkType(&amp;#039;numKeys&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local isPositiveInteger = export.isPositiveInteger&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	for k, _ in pairs(t) do&lt;br /&gt;
		if isPositiveInteger(k) then&lt;br /&gt;
			nums[index] = k&lt;br /&gt;
			index = index + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.maxIndex(t)&lt;br /&gt;
	checkType(&amp;#039;maxIndex&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	local positiveIntegerKeys = export.numKeys(t)&lt;br /&gt;
	if positiveIntegerKeys[1] then&lt;br /&gt;
		return math.max(unpack(positiveIntegerKeys))&lt;br /&gt;
	else&lt;br /&gt;
		return 0 -- ???&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- affixNums&lt;br /&gt;
--&lt;br /&gt;
-- This takes a table and returns an array containing the numbers of keys with the&lt;br /&gt;
-- specified prefix and suffix.&lt;br /&gt;
-- affixNums({a1 = &amp;#039;foo&amp;#039;, a3 = &amp;#039;bar&amp;#039;, a6 = &amp;#039;baz&amp;#039;}, &amp;quot;a&amp;quot;)&lt;br /&gt;
--		↓&lt;br /&gt;
-- {1, 3, 6}.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.affixNums(t, prefix, suffix)&lt;br /&gt;
	local check = _check(&amp;#039;affixNums&amp;#039;)&lt;br /&gt;
	check(1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	check(2, prefix, &amp;#039;string&amp;#039;, true)&lt;br /&gt;
	check(3, suffix, &amp;#039;string&amp;#039;, true)&lt;br /&gt;
	&lt;br /&gt;
	local function cleanPattern(s)&lt;br /&gt;
		-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.&lt;br /&gt;
		s = s:gsub(&amp;#039;([%(%)%%%.%[%]%*%+%-%?%^%$])&amp;#039;, &amp;#039;%%%1&amp;#039;)&lt;br /&gt;
		return s&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	prefix = prefix or &amp;#039;&amp;#039;&lt;br /&gt;
	suffix = suffix or &amp;#039;&amp;#039;&lt;br /&gt;
	prefix = cleanPattern(prefix)&lt;br /&gt;
	suffix = cleanPattern(suffix)&lt;br /&gt;
	local pattern = &amp;#039;^&amp;#039; .. prefix .. &amp;#039;([1-9]%d*)&amp;#039; .. suffix .. &amp;#039;$&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	for k, _ in pairs(t) do&lt;br /&gt;
		if type(k) == &amp;#039;string&amp;#039; then&lt;br /&gt;
			local num = mw.ustring.match(k, pattern)&lt;br /&gt;
			if num then&lt;br /&gt;
				nums[index] = tonumber(num)&lt;br /&gt;
				index = index + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- numData&lt;br /&gt;
--&lt;br /&gt;
-- Given a table with keys like (&amp;quot;foo1&amp;quot;, &amp;quot;bar1&amp;quot;, &amp;quot;foo2&amp;quot;, &amp;quot;baz2&amp;quot;), returns a table&lt;br /&gt;
-- of subtables in the format&lt;br /&gt;
-- { [1] = {foo = &amp;#039;text&amp;#039;, bar = &amp;#039;text&amp;#039;}, [2] = {foo = &amp;#039;text&amp;#039;, baz = &amp;#039;text&amp;#039;} }&lt;br /&gt;
-- Keys that don&amp;#039;t end with an integer are stored in a subtable named &amp;quot;other&amp;quot;.&lt;br /&gt;
-- The compress option compresses the table so that it can be iterated over with&lt;br /&gt;
-- ipairs.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.numData(t, compress)&lt;br /&gt;
	local check = _check(&amp;#039;numData&amp;#039;)&lt;br /&gt;
	check(1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	check(2, compress, &amp;#039;boolean&amp;#039;, true)&lt;br /&gt;
	&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for k, v in pairs(t) do&lt;br /&gt;
		local prefix, num = tostring(k):match(&amp;#039;^([^0-9]*)([1-9][0-9]*)$&amp;#039;)&lt;br /&gt;
		if num then&lt;br /&gt;
			num = tonumber(num)&lt;br /&gt;
			local subtable = ret[num] or {}&lt;br /&gt;
			if prefix == &amp;#039;&amp;#039; then&lt;br /&gt;
				-- Positional parameters match the blank string; put them at the start of the subtable instead.&lt;br /&gt;
				prefix = 1&lt;br /&gt;
			end&lt;br /&gt;
			subtable[prefix] = v&lt;br /&gt;
			ret[num] = subtable&lt;br /&gt;
		else&lt;br /&gt;
			local subtable = ret.other or {}&lt;br /&gt;
			subtable[k] = v&lt;br /&gt;
			ret.other = subtable&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if compress then&lt;br /&gt;
		local other = ret.other&lt;br /&gt;
		ret = export.compressSparseArray(ret)&lt;br /&gt;
		ret.other = other&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- compressSparseArray&lt;br /&gt;
--&lt;br /&gt;
-- This takes an array with one or more nil values, and removes the nil values&lt;br /&gt;
-- while preserving the order, so that the array can be safely traversed with&lt;br /&gt;
-- ipairs.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.compressSparseArray(t)&lt;br /&gt;
	checkType(&amp;#039;compressSparseArray&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	local nums = export.numKeys(t)&lt;br /&gt;
	for _, num in ipairs(nums) do&lt;br /&gt;
		ret[index] = t[num]&lt;br /&gt;
		index = index + 1&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- sparseIpairs&lt;br /&gt;
--&lt;br /&gt;
-- This is an iterator for sparse arrays. It can be used like ipairs, but can&lt;br /&gt;
-- handle nil values.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.sparseIpairs(t)&lt;br /&gt;
	checkType(&amp;#039;sparseIpairs&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	local nums = export.numKeys(t)&lt;br /&gt;
	local i = 0&lt;br /&gt;
	return function()&lt;br /&gt;
		i = i + 1&lt;br /&gt;
		local key = nums[i]&lt;br /&gt;
		if key then&lt;br /&gt;
			return key, t[key]&lt;br /&gt;
		else&lt;br /&gt;
			return nil, nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- size&lt;br /&gt;
--&lt;br /&gt;
-- This returns the size of a key/value pair table. It will also work on arrays,&lt;br /&gt;
-- but for arrays it is more efficient to use the # operator.&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function export.size(t)&lt;br /&gt;
	checkType(&amp;#039;size&amp;#039;, 1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	local i = 0&lt;br /&gt;
	for _ in pairs(t) do&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
	return i&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- This returns the length of a table, or the first integer key n counting from&lt;br /&gt;
-- 1 such that t[n + 1] is nil. It is similar to the operator #, but may return&lt;br /&gt;
-- a different value when there are gaps in the array portion of the table.&lt;br /&gt;
-- Intended to be used on data loaded with mw.loadData. For other tables, use #.&lt;br /&gt;
--]]&lt;br /&gt;
function export.length(t)&lt;br /&gt;
	local i = 0&lt;br /&gt;
	repeat&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	until t[i] == nil&lt;br /&gt;
	return i - 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Recursively compare two values that may be tables, including tables with&lt;br /&gt;
nested tables as values. Return true if both values are structurally equal.&lt;br /&gt;
Note that this handles arbitary levels of nesting. If all tables are known&lt;br /&gt;
to be lists (with only integral keys), use export.deepEqualsList, which will&lt;br /&gt;
be more efficient.&lt;br /&gt;
&lt;br /&gt;
If `includeMetatables` is true, then metatables will also be compared. However,&lt;br /&gt;
by default, metatables from mw.loadData will not be included in this comparison.&lt;br /&gt;
This is because the metatable changes each time mw.loadData is used, even if&lt;br /&gt;
it is used on the same data. This can be overridden by setting `rawCompare` to&lt;br /&gt;
true.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function export.deepEquals(x, y, includeMetatables, rawCompare)&lt;br /&gt;
	local already_seen = {}&lt;br /&gt;
	&lt;br /&gt;
	-- This strips metatables only from data loaded via mw.loadData.&lt;br /&gt;
	if includeMetatables and not rawCompare then&lt;br /&gt;
		x = export.deepcopy(x)&lt;br /&gt;
		y = export.deepcopy(y)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local function de(x, y)&lt;br /&gt;
		if type(x) == &amp;quot;table&amp;quot; and type(y) == &amp;quot;table&amp;quot; then&lt;br /&gt;
			-- Two tables are the same if they have the same number of&lt;br /&gt;
			-- elements and all keys that are present in one of the tables &lt;br /&gt;
			-- compare equal to the corresponding keys in the other table, &lt;br /&gt;
			-- using structural comparison.&lt;br /&gt;
			-- If an element of x is a table, then its table in `already_seen` &lt;br /&gt;
			-- is checked for y (which means they have been compared before). &lt;br /&gt;
			-- If so, immediately iterate to avoid duplicated work. This avoids &lt;br /&gt;
			-- infinite loops.&lt;br /&gt;
			if not already_seen[x] then&lt;br /&gt;
				already_seen[x] = {}&lt;br /&gt;
				if not already_seen[x][y] then&lt;br /&gt;
					already_seen[x][y] = true&lt;br /&gt;
					local sizex = 0&lt;br /&gt;
					for key, value in pairs(x) do&lt;br /&gt;
						if not de(value, y[key]) then&lt;br /&gt;
							return false&lt;br /&gt;
						end&lt;br /&gt;
						sizex = sizex + 1&lt;br /&gt;
					end&lt;br /&gt;
					if includeMetatables and not de(getmetatable(x), getmetatable(y)) then&lt;br /&gt;
						return false&lt;br /&gt;
					end&lt;br /&gt;
					local sizey = export.size(y)&lt;br /&gt;
					if sizex ~= sizey then&lt;br /&gt;
						return false&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
		return x == y&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return de(x, y)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Recursively compare two values that may be lists (i.e. tables with integral&lt;br /&gt;
keys), including lists with nested lists as values. Return true if both values&lt;br /&gt;
are structurally equal. Note that this handles arbitary levels of nesting.&lt;br /&gt;
Results are undefined if tables with non-integral keys are present anywhere in&lt;br /&gt;
either structure; if that may be the case, use export.deepEquals, which will&lt;br /&gt;
handle such tables correctly but be less efficient on lists than&lt;br /&gt;
export.deepEqualsList.&lt;br /&gt;
]]&lt;br /&gt;
function export.deepEqualsList(x, y)&lt;br /&gt;
	local already_seen = {}&lt;br /&gt;
	&lt;br /&gt;
	local function de(x, y)&lt;br /&gt;
		if type(x) == &amp;quot;table&amp;quot; and type(y) == &amp;quot;table&amp;quot; then&lt;br /&gt;
			if not already_seen[x] then&lt;br /&gt;
				already_seen[x] = {}&lt;br /&gt;
				if not already_seen[x][y] then&lt;br /&gt;
					already_seen[x][y] = true&lt;br /&gt;
					if #x ~= #y then&lt;br /&gt;
						return false&lt;br /&gt;
					end &lt;br /&gt;
					for key, value in pairs(x) do&lt;br /&gt;
						if not de(value, y[key]) then&lt;br /&gt;
							return false&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
		return x == y&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return de(x, y)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Given a list and a value to be found, return true if the value is in the array&lt;br /&gt;
portion of the list. Comparison is by value, using `deepEquals`.&lt;br /&gt;
&lt;br /&gt;
NOTE: This used to do shallow comparison by default and accepted a third&lt;br /&gt;
&amp;#039;deepCompare&amp;#039; param to do deep comparison. This param is still accepted but now&lt;br /&gt;
ignored.&lt;br /&gt;
]]&lt;br /&gt;
function export.contains(list, x)&lt;br /&gt;
	checkType(&amp;#039;contains&amp;#039;, 1, list, &amp;#039;table&amp;#039;)&lt;br /&gt;
	for _, v in ipairs(list) do&lt;br /&gt;
		if export.deepEquals(v, x) then return true end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Given a general table and a value to be found, return true if the value is in&lt;br /&gt;
either the array or hashmap portion of the table. Comparison is by value, using&lt;br /&gt;
`deepEquals`.&lt;br /&gt;
&lt;br /&gt;
NOTE: This used to do shallow comparison by default and accepted a third&lt;br /&gt;
&amp;#039;deepCompare&amp;#039; param to do deep comparison. This param is still accepted but now&lt;br /&gt;
ignored.&lt;br /&gt;
]]&lt;br /&gt;
function export.tableContains(tbl, x)&lt;br /&gt;
	checkType(&amp;#039;tableContains&amp;#039;, 1, tbl, &amp;#039;table&amp;#039;)&lt;br /&gt;
	for _, v in pairs(tbl) do&lt;br /&gt;
		if export.deepEquals(v, x) then return true end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Given a list and a value to be inserted, append or insert the value if not&lt;br /&gt;
already present in the list. Comparison is by value, using `deepEquals`.&lt;br /&gt;
Appends to the end, like the default behavior of table.insert(), unless `pos`&lt;br /&gt;
is given, in which case insertion happens at position `pos` (i.e. before the&lt;br /&gt;
existing item at position `pos`).&lt;br /&gt;
&lt;br /&gt;
NOTE: The order of `item` and `pos` is reversed in comparison to table.insert(),&lt;br /&gt;
which uses `table.insert(list, item)` to insert at the end but&lt;br /&gt;
`table.insert(list, pos, item)` to insert at position POS.&lt;br /&gt;
&lt;br /&gt;
NOTE: This used to do shallow comparison by default and accepted a fourth&lt;br /&gt;
&amp;#039;deepCompare&amp;#039; param to do deep comparison. This param is still accepted but now&lt;br /&gt;
ignored.&lt;br /&gt;
]]&lt;br /&gt;
function export.insertIfNot(list, item, pos)&lt;br /&gt;
	if not export.contains(list, item) then&lt;br /&gt;
		if pos then&lt;br /&gt;
			table.insert(list, pos, item)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(list, item)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Finds key for specified value in a given table.&lt;br /&gt;
	Roughly equivalent to reversing the key-value pairs in the table –&lt;br /&gt;
		reversed_table = { [value1] = key1, [value2] = key2, ... }&lt;br /&gt;
	– and then returning reversed_table[valueToFind].&lt;br /&gt;
	&lt;br /&gt;
	The value can only be a string or a number&lt;br /&gt;
	(not nil, a boolean, a table, or a function).&lt;br /&gt;
	&lt;br /&gt;
	Only reliable if there is just one key with the specified value.&lt;br /&gt;
	Otherwise, the function returns the first key found,&lt;br /&gt;
	and the output is unpredictable.&lt;br /&gt;
]]&lt;br /&gt;
function export.keyFor(t, valueToFind)&lt;br /&gt;
	local check = _check(&amp;#039;keyFor&amp;#039;)&lt;br /&gt;
	check(1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	check(2, valueToFind, { &amp;#039;string&amp;#039;, &amp;#039;number&amp;#039; })&lt;br /&gt;
	&lt;br /&gt;
	for key, value in pairs(t) do&lt;br /&gt;
		if value == valueToFind then&lt;br /&gt;
			return key&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	The default sorting function used in export.keysToList if no keySort&lt;br /&gt;
	is defined.&lt;br /&gt;
]]&lt;br /&gt;
local function defaultKeySort(key1, key2)&lt;br /&gt;
	-- &amp;quot;number&amp;quot; &amp;lt; &amp;quot;string&amp;quot;, so numbers will be sorted before strings.&lt;br /&gt;
	local type1, type2 = type(key1), type(key2)&lt;br /&gt;
	if type1 ~= type2 then&lt;br /&gt;
		return type1 &amp;lt; type2&lt;br /&gt;
	else&lt;br /&gt;
		return key1 &amp;lt; key2&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Returns a list of the keys in a table, sorted using either the default&lt;br /&gt;
	table.sort function or a custom keySort function.&lt;br /&gt;
	If there are only numerical keys, numKeys is probably more efficient.&lt;br /&gt;
]]&lt;br /&gt;
function export.keysToList(t, keySort, checked)&lt;br /&gt;
	if not checked then&lt;br /&gt;
		local check = _check(&amp;#039;keysToList&amp;#039;)&lt;br /&gt;
		check(1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
		check(2, keySort, &amp;#039;function&amp;#039;, true)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local list = {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	for key, _ in pairs(t) do&lt;br /&gt;
		list[index] = key&lt;br /&gt;
		index = index + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Place numbers before strings, otherwise sort using &amp;lt;.&lt;br /&gt;
	if not keySort then&lt;br /&gt;
		keySort = defaultKeySort&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.sort(list, keySort)&lt;br /&gt;
	&lt;br /&gt;
	return list&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Iterates through a table, with the keys sorted using the keysToList function.&lt;br /&gt;
	If there are only numerical keys, sparseIpairs is probably more efficient.&lt;br /&gt;
]]&lt;br /&gt;
function export.sortedPairs(t, keySort)&lt;br /&gt;
	local check = _check(&amp;#039;keysToList&amp;#039;)&lt;br /&gt;
	check(1, t, &amp;#039;table&amp;#039;)&lt;br /&gt;
	check(2, keySort, &amp;#039;function&amp;#039;, true)&lt;br /&gt;
	&lt;br /&gt;
	local list = export.keysToList(t, keySort, true)&lt;br /&gt;
	&lt;br /&gt;
	local i = 0&lt;br /&gt;
	return function()&lt;br /&gt;
		i = i + 1&lt;br /&gt;
		local key = list[i]&lt;br /&gt;
		if key ~= nil then&lt;br /&gt;
			return key, t[key]&lt;br /&gt;
		else&lt;br /&gt;
			return nil, nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.reverseIpairs(list)&lt;br /&gt;
	checkType(&amp;#039;reverse_ipairs&amp;#039;, 1, list, &amp;#039;table&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local i = #list + 1&lt;br /&gt;
	return function()&lt;br /&gt;
		i = i - 1&lt;br /&gt;
		if list[i] ~= nil then&lt;br /&gt;
			return i, list[i]&lt;br /&gt;
		else&lt;br /&gt;
			return nil, nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	A set of functions that, given an array and function, iterate through the array applying that function.&lt;br /&gt;
	`reduce` applies func(r, k, v), and returns the result, where r is the value calculated so far, k is an index, and v is the value at index k.  For example, reduce(array, function(a, b) return a + b end) will return the sum of `array`.&lt;br /&gt;
	`apply` applies func(k, v), and returns the modified array. For example, apply(array, function(a) return 2*a end) will return an array where each member of `array` has been doubled.&lt;br /&gt;
	`all` returns whether func(k, v) is true for all iterations.&lt;br /&gt;
	`any` returns whether func(k, v) is true for at least one iteration.&lt;br /&gt;
	&lt;br /&gt;
	Optional arguments:&lt;br /&gt;
		i: start index; negative values count from the end of the array&lt;br /&gt;
		j: end index; negative values count from the end of the array&lt;br /&gt;
		s: step increment&lt;br /&gt;
		These must be non-zero integers.&lt;br /&gt;
		The function will determine where to iterate from, whether to iterate forwards or backwards and by how much, based on these inputs (see examples below for default behaviours).&lt;br /&gt;
	Examples:&lt;br /&gt;
		No values for i, j or s results in forward iteration from the start to the end in steps of 1 (the default).&lt;br /&gt;
		s=-1 results in backward iteration from the end to the start in steps of 1.&lt;br /&gt;
		i=7, j=3 results in backward iteration from indices 7 to 3 in steps of 1 (i.e. s=-1).&lt;br /&gt;
		j=-3 results in forward iteration from the start to the 3rd last index.&lt;br /&gt;
		j=-3, s=-1 results in backward iteration from the end to the 3rd last index.&lt;br /&gt;
	Note: directionality generally only matters for `reduce`, but values of s &amp;gt; 1 (or s &amp;lt; -1) still affect the return value of `apply`.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function getIteratorValues(i, j , s, list)&lt;br /&gt;
	i = (i and i &amp;lt; 0 and #list - i + 1) or i or (s and s &amp;lt; 0 and #list) or 1&lt;br /&gt;
	j = (j and j &amp;lt; 0 and #list - j + 1) or j or (s and s &amp;lt; 0 and 1) or #list&lt;br /&gt;
	s = s or (j &amp;lt; i and -1) or 1&lt;br /&gt;
	if (&lt;br /&gt;
		i == 0 or i % 1 ~= 0 or&lt;br /&gt;
		j == 0 or j % 1 ~= 0 or&lt;br /&gt;
		s == 0 or s % 1 ~= 0&lt;br /&gt;
	) then&lt;br /&gt;
		error(&amp;quot;Arguments i, j and s must be non-zero integers.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	return i, j, s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.reduce(list, func, i, j, s)&lt;br /&gt;
	i, j, s = getIteratorValues(i, j , s, list)&lt;br /&gt;
	local ret = list[i]&lt;br /&gt;
	for k = i + s, j, s do&lt;br /&gt;
		ret = func(ret, k, list[k])&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.apply(list, func, i, j, s)&lt;br /&gt;
	local modified_list = export.deepcopy(list)&lt;br /&gt;
	i, j, s = getIteratorValues(i, j , s, modified_list)&lt;br /&gt;
	for k = i, j, s do&lt;br /&gt;
		modified_list[k] = func(k, modified_list[k])&lt;br /&gt;
	end&lt;br /&gt;
	return modified_list&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.all(list, func, i, j, s)&lt;br /&gt;
	i, j, s = getIteratorValues(i, j , s, list)&lt;br /&gt;
	local ret = true&lt;br /&gt;
	for k = i, j, s do&lt;br /&gt;
		ret = ret and not not (func(k, list[k]))&lt;br /&gt;
		if not ret then break end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.any(list, func, i, j, s)&lt;br /&gt;
	i, j, s = getIteratorValues(i, j , s, list)&lt;br /&gt;
	local ret = false&lt;br /&gt;
	for k = i, j, s do&lt;br /&gt;
		ret = ret or not not (func(k, list[k]))&lt;br /&gt;
		if ret then break end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[=[&lt;br /&gt;
	Joins an array with serial comma and serial conjunction, normally &amp;quot;and&amp;quot;.&lt;br /&gt;
	An improvement on mw.text.listToText, which doesn&amp;#039;t properly handle serial&lt;br /&gt;
	commas.&lt;br /&gt;
	&lt;br /&gt;
	Options:&lt;br /&gt;
		- conj&lt;br /&gt;
			Conjunction to use; defaults to &amp;quot;and&amp;quot;.&lt;br /&gt;
		- italicizeConj&lt;br /&gt;
			Italicize conjunction: for [[Module:also]]&lt;br /&gt;
		- dontTag&lt;br /&gt;
			Don&amp;#039;t tag the serial comma and serial &amp;quot;and&amp;quot;. For error messages, in&lt;br /&gt;
			which HTML cannot be used.&lt;br /&gt;
]=]&lt;br /&gt;
function export.serialCommaJoin(seq, options)&lt;br /&gt;
	local check = _check(&amp;quot;serialCommaJoin&amp;quot;, &amp;quot;table&amp;quot;)&lt;br /&gt;
	check(1, seq)&lt;br /&gt;
	check(2, options, true)&lt;br /&gt;
	&lt;br /&gt;
	local length = #seq&lt;br /&gt;
	&lt;br /&gt;
	if not options then&lt;br /&gt;
		options = {}&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local conj&lt;br /&gt;
	if length &amp;gt; 1 then&lt;br /&gt;
		conj = options.conj or &amp;quot;and&amp;quot;&lt;br /&gt;
		if options.italicizeConj then&lt;br /&gt;
			conj = &amp;quot;&amp;#039;&amp;#039;&amp;quot; .. conj .. &amp;quot;&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if length == 0 then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	elseif length == 1 then&lt;br /&gt;
		return seq[1] -- nothing to join&lt;br /&gt;
	elseif length == 2 then&lt;br /&gt;
		return seq[1] .. &amp;quot; &amp;quot; .. conj .. &amp;quot; &amp;quot; .. seq[2]&lt;br /&gt;
	else&lt;br /&gt;
		local comma = options.dontTag and &amp;quot;,&amp;quot; or &amp;#039;&amp;lt;span class=&amp;quot;serial-comma&amp;quot;&amp;gt;,&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		conj = options.dontTag and &amp;#039; &amp;#039; .. conj .. &amp;quot; &amp;quot; or &amp;#039;&amp;lt;span class=&amp;quot;serial-and&amp;quot;&amp;gt; &amp;#039; .. conj .. &amp;#039;&amp;lt;/span&amp;gt; &amp;#039;&lt;br /&gt;
		return table.concat(seq, &amp;quot;, &amp;quot;, 1, length - 1) ..&lt;br /&gt;
				comma .. conj .. seq[length]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Concatenates all values in the table that are indexed by a number, in order.&lt;br /&gt;
	sparseConcat{ a, nil, c, d }  =&amp;gt;  &amp;quot;acd&amp;quot;&lt;br /&gt;
	sparseConcat{ nil, b, c, d }  =&amp;gt;  &amp;quot;bcd&amp;quot;&lt;br /&gt;
]]&lt;br /&gt;
function export.sparseConcat(t, sep, i, j)&lt;br /&gt;
	local list = {}&lt;br /&gt;
	&lt;br /&gt;
	local list_i = 0&lt;br /&gt;
	for _, v in export.sparseIpairs(t) do&lt;br /&gt;
		list_i = list_i + 1&lt;br /&gt;
		list[list_i] = v&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat(list, sep, i, j)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Values of numberic keys in array portion of table are reversed:&lt;br /&gt;
	{ &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot; } -&amp;gt; { &amp;quot;c&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;a&amp;quot; }&lt;br /&gt;
--]]&lt;br /&gt;
function export.reverse(t)&lt;br /&gt;
	checkType(&amp;quot;reverse&amp;quot;, 1, t, &amp;quot;table&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	local new_t = {}&lt;br /&gt;
	local t_len = #t&lt;br /&gt;
	local base = t_len + 1&lt;br /&gt;
	for i = t_len, 1, -1 do&lt;br /&gt;
		new_t[base-i] = t[i]&lt;br /&gt;
	end&lt;br /&gt;
	return new_t&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.reverseConcat(t, sep, i, j)&lt;br /&gt;
	return table.concat(export.reverse(t), sep, i, j)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- { &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot; } -&amp;gt; { a = 1, b = 2, c = 3 }&lt;br /&gt;
function export.invert(array)&lt;br /&gt;
	checkType(&amp;quot;invert&amp;quot;, 1, array, &amp;quot;table&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	local map = {}&lt;br /&gt;
	for i, v in ipairs(array) do&lt;br /&gt;
		map[v] = i&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return map&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	{ &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot; } -&amp;gt; { [&amp;quot;a&amp;quot;] = true, [&amp;quot;b&amp;quot;] = true, [&amp;quot;c&amp;quot;] = true }&lt;br /&gt;
--]]&lt;br /&gt;
function export.listToSet(t)&lt;br /&gt;
	checkType(&amp;quot;listToSet&amp;quot;, 1, t, &amp;quot;table&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	local set = {}&lt;br /&gt;
	for _, item in ipairs(t) do&lt;br /&gt;
		set[item] = true&lt;br /&gt;
	end&lt;br /&gt;
	return set&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Returns true if all keys in the table are consecutive integers starting at 1.&lt;br /&gt;
--]]&lt;br /&gt;
function export.isArray(t)&lt;br /&gt;
	checkType(&amp;quot;isArray&amp;quot;, 1, t, &amp;quot;table&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	local i = 0&lt;br /&gt;
	for _ in pairs(t) do&lt;br /&gt;
		i = i + 1&lt;br /&gt;
		if t[i] == nil then&lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
	Add a list of aliases for a given key to a table. The aliases must be given as a table.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
function export.alias(t, k, aliases)&lt;br /&gt;
	for _, alias in pairs(aliases) do&lt;br /&gt;
		t[alias] = t[k]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>bob&gt;Vaxjedi</name></author>
	</entry>
</feed>