<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://compusofia.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ATableTools%2Fdoc</id>
	<title>Module:TableTools/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://compusofia.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ATableTools%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://compusofia.com/w/index.php?title=Module:TableTools/doc&amp;action=history"/>
	<updated>2026-04-19T03:10:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://compusofia.com/w/index.php?title=Module:TableTools/doc&amp;diff=332&amp;oldid=prev</id>
		<title>Majestix: 1 revision imported: Initial Setup</title>
		<link rel="alternate" type="text/html" href="https://compusofia.com/w/index.php?title=Module:TableTools/doc&amp;diff=332&amp;oldid=prev"/>
		<updated>2026-04-06T09:48:52Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Initial Setup&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 11:48, 6 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 wikiNonStop:diff:1.41:old-331:rev-332 --&gt;
&lt;/table&gt;</summary>
		<author><name>Majestix</name></author>
	</entry>
	<entry>
		<id>https://compusofia.com/w/index.php?title=Module:TableTools/doc&amp;diff=331&amp;oldid=prev</id>
		<title>en&gt;Tactica: rm {{Shared Template Warning}}.</title>
		<link rel="alternate" type="text/html" href="https://compusofia.com/w/index.php?title=Module:TableTools/doc&amp;diff=331&amp;oldid=prev"/>
		<updated>2025-10-13T18:25:20Z</updated>

		<summary type="html">&lt;p&gt;rm {{Shared Template Warning}}.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&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 not be called directly from #invoke.&lt;br /&gt;
&lt;br /&gt;
== Module Quality ==&lt;br /&gt;
{{ModuleQuality}}&lt;br /&gt;
&lt;br /&gt;
== Loading the module ==&lt;br /&gt;
&lt;br /&gt;
To use any of the functions, first you must load the module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local TableTools = require(&amp;#039;Module:TableTools&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
=== isPositiveInteger ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.isPositiveInteger(value)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if &amp;lt;code&amp;gt;&amp;#039;&amp;#039;value&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is a positive integer, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; if not.&lt;br /&gt;
Although it doesn&amp;#039;t operate on tables, it is included here as it is useful for determining whether a given table key is in the array part or the hash part of a table.&lt;br /&gt;
&lt;br /&gt;
=== isNan ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.isNan(value)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if &amp;lt;code&amp;gt;&amp;#039;&amp;#039;value&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is a [[w:NaN|NaN]] value, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; if not. Although it doesn&amp;#039;t operate on tables, it is included here as it is useful for determining whether a value can be a valid table key. (Lua will generate an error if a NaN value is used as a table key.)&lt;br /&gt;
&lt;br /&gt;
=== shallowClone ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.shallowClone(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a clone of a table. The value 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 its own. If you want to make a new table with no shared subtables and with metatables transferred, you can use &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#mw.clone|mw.clone]]&amp;lt;/code&amp;gt; instead. If you want to make a new table with no shared subtables and without metatables transferred, use &amp;lt;code&amp;gt;[[#deepCopy|deepCopy]]&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;noMetatable&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
=== removeDuplicates ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.removeDuplicates(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Removes duplicate values from an array.&lt;br /&gt;
This function is only designed to work with standard arrays: keys that are not positive integers are ignored, as are all values after the first &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; value. (For arrays containing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values, you can use &amp;lt;code&amp;gt;[[#compressSparseArray|compressSparseArray]]&amp;lt;/code&amp;gt; first.) The function tries to preserve the order of the array: the earliest non-unique value is kept, and all subsequent duplicate values are removed.&lt;br /&gt;
&lt;br /&gt;
For example, for the table &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{5, 4, 4, 3, 4, 2, 2, 1}&amp;lt;/syntaxhighlight&amp;gt; &amp;lt;code&amp;gt;removeDuplicates&amp;lt;/code&amp;gt; will return &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{5, 4, 3, 2, 1}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== numKeys ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.numKeys(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a table &amp;lt;code&amp;gt;&amp;#039;&amp;#039;t&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and returns an array containing the numbers of any positive integer keys that have non-nil values, sorted in numerical order.&lt;br /&gt;
&lt;br /&gt;
For example, for the table &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&amp;#039;foo&amp;#039;, nil, &amp;#039;bar&amp;#039;, &amp;#039;baz&amp;#039;, a = &amp;#039;b&amp;#039;}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;code&amp;gt;numKeys&amp;lt;/code&amp;gt; will return &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{1, 3, 4}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== affixNums ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.affixNums(t, prefix, suffix)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a table &amp;lt;code&amp;gt;&amp;#039;&amp;#039;t&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and returns an array containing the numbers of keys with the optional prefix &amp;lt;code&amp;gt;&amp;#039;&amp;#039;prefix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and the optional suffix &amp;lt;code&amp;gt;&amp;#039;&amp;#039;suffix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For example, for the table &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{a1 = &amp;#039;foo&amp;#039;, a3 = &amp;#039;bar&amp;#039;, a6 = &amp;#039;baz&amp;#039;}&amp;lt;/syntaxhighlight&amp;gt; and the prefix &amp;lt;code&amp;gt;&amp;#039;a&amp;#039;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;affixNums&amp;lt;/code&amp;gt; will return &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{1, 3, 6}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All characters in &amp;lt;code&amp;gt;&amp;#039;&amp;#039;prefix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;#039;&amp;#039;suffix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; are interpreted literally.&lt;br /&gt;
&lt;br /&gt;
=== numData ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.numData(t, compress)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a table with keys like &amp;lt;code&amp;gt;&amp;quot;foo1&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;quot;bar1&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;quot;foo2&amp;quot;&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;&amp;quot;baz2&amp;quot;&amp;lt;/code&amp;gt;, returns a table of subtables in the format &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;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;} }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keys that don&amp;#039;t end with an integer are stored in a subtable named &amp;lt;code&amp;gt;&amp;quot;other&amp;quot;&amp;lt;/code&amp;gt;. The compress option compresses the table so that it can be iterated over with &amp;lt;code&amp;gt;ipairs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== compressSparseArray ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.compressSparseArray(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes an array &amp;lt;code&amp;gt;&amp;#039;&amp;#039;t&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; with one or more nil values, and removes the nil values while preserving the order, so that the array can be safely traversed with &amp;lt;code&amp;gt;ipairs&amp;lt;/code&amp;gt;. Any keys that are not positive integers are removed.&lt;br /&gt;
&lt;br /&gt;
For example, for the table &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{1, nil, foo = &amp;#039;bar&amp;#039;, 3, 2}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;code&amp;gt;compressSparseArray&amp;lt;/code&amp;gt; will return &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{1, 3, 2}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== sparseIpairs ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.sparseIpairs(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is an iterator function for traversing a sparse array &amp;lt;code&amp;gt;&amp;#039;&amp;#039;t&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;. It is similar to &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#ipairs|ipairs]]&amp;lt;/code&amp;gt;, but will continue to iterate until the highest numerical key, whereas &amp;lt;code&amp;gt;ipairs&amp;lt;/code&amp;gt; may stop after the first &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; value. Any keys that are not positive integers are ignored.&lt;br /&gt;
&lt;br /&gt;
Usually &amp;lt;code&amp;gt;sparseIpairs&amp;lt;/code&amp;gt; is used in a generic &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
for i, v in TableTools.sparseIpairs(t) do&lt;br /&gt;
   -- code block&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;code&amp;gt;sparseIpairs&amp;lt;/code&amp;gt; uses the &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#pairs|pairs]]&amp;lt;/code&amp;gt; function in its implementation. Although some table keys appear to be ignored, all table keys are accessed when it is run.&lt;br /&gt;
&lt;br /&gt;
=== size ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.size(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finds the size of a key/value pair table.&lt;br /&gt;
&lt;br /&gt;
For example, for the table &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{foo = &amp;#039;foo&amp;#039;, bar = &amp;#039;bar&amp;#039;}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; will return &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The function will also work on arrays, but for arrays it is more efficient to use the &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; operator.&lt;br /&gt;
Note that to find the table size, this function uses the &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#pairs|pairs]]&amp;lt;/code&amp;gt; function to iterate through all of the table keys.&lt;br /&gt;
&lt;br /&gt;
=== keysToList ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.keysToList(t, keySort)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a list of the keys in a table, sorted using either a default comparison function or a custom &amp;lt;code&amp;gt;keySort&amp;lt;/code&amp;gt; function, which  follows the same rules as the &amp;lt;code&amp;gt;comp&amp;lt;/code&amp;gt; function supplied to &amp;lt;code&amp;gt;{{ll|Extension:Scribunto/Lua reference manual#table.sort|table.sort}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== sortedPairs ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.sortedPairs(t, keySort)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Iterates through a table, with the keys sorted using the &amp;lt;code&amp;gt;keysToList&amp;lt;/code&amp;gt; function. If there are only numerical keys, &amp;lt;code&amp;gt;sparseIpairs&amp;lt;/code&amp;gt; is probably more efficient.&lt;br /&gt;
&lt;br /&gt;
=== isArray ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.isArray(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns true if all keys in the table are consecutive integers starting at &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== listToSet ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.listToSet(arr)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a set from the array part of the table &amp;lt;code&amp;gt;arr&amp;lt;/code&amp;gt;. Indexing the set by any of the values in &amp;lt;code&amp;gt;arr&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local set = TableTools.listToSet { &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot; }&lt;br /&gt;
assert(set[&amp;quot;a&amp;quot;] === true)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== invert ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.invert(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transposes the keys and values in an array.&lt;br /&gt;
For example, &amp;lt;code&amp;gt;invert{ &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot; }&amp;lt;/code&amp;gt; yields &amp;lt;code&amp;gt;{ a = 1, b = 2, c = 3 }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== deepCopy ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.deepCopy(orig, noMetatable, alreadySeen)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates a copy of the table &amp;lt;code&amp;gt;orig&amp;lt;/code&amp;gt;. As with &amp;lt;code&amp;gt;mw.clone&amp;lt;/code&amp;gt;, all values that are not functions are duplicated and the identity of tables is preserved. If &amp;lt;code&amp;gt;noMetatable&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, then the metatable (if any) is not copied. Can copy tables loaded with &amp;lt;code&amp;gt;mw.loadData&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Similar to &amp;lt;code&amp;gt;mw.clone&amp;lt;/code&amp;gt;, but &amp;lt;code&amp;gt;mw.clone&amp;lt;/code&amp;gt; cannot copy tables loaded with &amp;lt;code&amp;gt;mw.loadData&amp;lt;/code&amp;gt; and does not allow metatables &amp;lt;em&amp;gt;not&amp;lt;/em&amp;gt; to be copied.&lt;br /&gt;
&lt;br /&gt;
=== sparseConcat ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.sparseConcat(t, sep)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Concatenates all values in the table that are indexed by a positive integer, in order.&lt;br /&gt;
&lt;br /&gt;
=== length ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.length(t)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the length of a table, or the first integer key &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; counting from &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; such that &amp;lt;code&amp;gt;t[n + 1]&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. It is similar to the operator &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;, but may return a different value when there are gaps in the array portion of the table. Intended to be used on data loaded with &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#mw.loadData|mw.loadData]]&amp;lt;/code&amp;gt; and on &amp;lt;code&amp;gt;[[mw:Special:MyLanguage/Extension:Scribunto/Lua reference manual#frame.args|frame.args]]&amp;lt;/code&amp;gt;. Both use a metatable such that &amp;lt;code&amp;gt;#mw.loadData(&amp;quot;module:...&amp;quot;)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;#frame.args&amp;lt;/code&amp;gt; don&amp;#039;t work correctly. For other tables, use &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== inArray ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableTools.inArray(arr, valueToFind)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; inline&amp;gt;true&amp;lt;/syntaxhighlight&amp;gt; if &amp;lt;code&amp;gt;valueToFind&amp;lt;/code&amp;gt; is a member of the array &amp;lt;code&amp;gt;arr&amp;lt;/code&amp;gt;, and &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; inline&amp;gt;false&amp;lt;/syntaxhighlight&amp;gt; otherwise.&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
[[Category:Lua metamodules|TableTools]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>en&gt;Tactica</name></author>
	</entry>
</feed>