<?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%3Aparameters%2Flite%2Flist</id>
	<title>Module:parameters/lite/list - 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%3Aparameters%2Flite%2Flist"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:parameters/lite/list&amp;action=history"/>
	<updated>2026-04-04T01:41:18Z</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:parameters/lite/list&amp;diff=292223&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local function clean(x) return x and #x &gt; 0 and x or nil end  -- implements a list parameter, somewhat return function (args, param, allow_holes, allow_empty) 	local results =...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:parameters/lite/list&amp;diff=292223&amp;oldid=prev"/>
		<updated>2022-11-30T19:24:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local function clean(x) return x and #x &amp;gt; 0 and x or nil end  -- implements a list parameter, somewhat return function (args, param, allow_holes, allow_empty) 	local results =...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local function clean(x) return x and #x &amp;gt; 0 and x or nil end&lt;br /&gt;
&lt;br /&gt;
-- implements a list parameter, somewhat&lt;br /&gt;
return function (args, param, allow_holes, allow_empty)&lt;br /&gt;
	local results = {clean(args[param] and mw.text.trim(args[param]))}&lt;br /&gt;
	local maximum_index = 0&lt;br /&gt;
	local pattern = &amp;quot;^&amp;quot; .. require(&amp;quot;Module:string/pattern escape&amp;quot;)(param) .. &amp;quot;([0-9]+)$&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	for key, value in pairs(args) do&lt;br /&gt;
		local index = mw.ustring.match(key, pattern)&lt;br /&gt;
		if index then&lt;br /&gt;
			index = tonumber(index)&lt;br /&gt;
			if index and index &amp;gt; 0 then&lt;br /&gt;
				value = value and mw.text.trim(value)&lt;br /&gt;
				if not allow_empty then value = clean(value) end&lt;br /&gt;
				results[index] = value&lt;br /&gt;
				maximum_index = math.max(maximum_index, index)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if maximum_index &amp;gt; 0 then&lt;br /&gt;
		if not allow_holes then&lt;br /&gt;
			local i = 1&lt;br /&gt;
			local j = 1&lt;br /&gt;
			while i &amp;lt;= maximum_index do&lt;br /&gt;
				if results[i] then&lt;br /&gt;
					results[j] = results[i]&lt;br /&gt;
					if j &amp;lt; i then results[i] = nil end&lt;br /&gt;
					j = j + 1&lt;br /&gt;
				end&lt;br /&gt;
				i = i + 1&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			results.maxindex = maximum_index&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return results&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>