<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://stationeers-wiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AImage_array</id>
	<title>Module:Image array - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stationeers-wiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AImage_array"/>
	<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/index.php?title=Module:Image_array&amp;action=history"/>
	<updated>2026-04-03T19:17:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://stationeers-wiki.com/index.php?title=Module:Image_array&amp;diff=9768&amp;oldid=prev</id>
		<title>JavaSkeptre: Create image array</title>
		<link rel="alternate" type="text/html" href="https://stationeers-wiki.com/index.php?title=Module:Image_array&amp;diff=9768&amp;oldid=prev"/>
		<updated>2020-11-11T02:55:53Z</updated>

		<summary type="html">&lt;p&gt;Create image array&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- implements [[template:image array]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function isnotempty(s)&lt;br /&gt;
	return s and s:match( &amp;#039;^%s*(.-)%s*$&amp;#039; ) ~= &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderArrayCell( img, c, a, b, l, tc, t, w, h)&lt;br /&gt;
	local alt = isnotempty(a) and (&amp;#039;|alt=&amp;#039; .. a) or &amp;#039;&amp;#039;&lt;br /&gt;
	local link = isnotempty(l) and (&amp;#039;|link=&amp;#039; .. l) or &amp;#039;&amp;#039;&lt;br /&gt;
	local text = (isnotempty(tc) and not isnotempty(t)) &lt;br /&gt;
		and mw.text.unstrip(c) or mw.text.unstrip(t or &amp;#039;&amp;#039;)&lt;br /&gt;
	local border = isnotempty(b) and &amp;#039;|border&amp;#039; or &amp;#039;&amp;#039;&lt;br /&gt;
		&lt;br /&gt;
	local cell = mw.html.create(&amp;#039;&amp;#039;)&lt;br /&gt;
	if( img ) then&lt;br /&gt;
		cell:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;display&amp;#039;, &amp;#039;table-cell&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;middle&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, w .. &amp;#039;px&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;height&amp;#039;, h .. &amp;#039;px&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;margin-left&amp;#039;, &amp;#039;auto&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;margin-right&amp;#039;, &amp;#039;auto&amp;#039;)&lt;br /&gt;
			:wikitext(mw.ustring.format(&amp;#039;[[File:%s|%dx%dpx%s|%s]]&amp;#039;, &lt;br /&gt;
				img, w, h, alt .. link .. border, text))&lt;br /&gt;
		cell:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;padding&amp;#039;, &amp;#039;1px&amp;#039;)&lt;br /&gt;
			:wikitext(c)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tostring(cell)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function imagearray( frame )&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	local width = tonumber(args[&amp;#039;width&amp;#039;] or &amp;#039;60&amp;#039;)&lt;br /&gt;
	local height = tonumber(args[&amp;#039;height&amp;#039;] or &amp;#039;70&amp;#039;)&lt;br /&gt;
	local perrow = tonumber(args[&amp;#039;perrow&amp;#039;] or &amp;#039;4&amp;#039;)&lt;br /&gt;
	local bw = tonumber(args[&amp;#039;border-width&amp;#039;] or &amp;#039;0&amp;#039;)&lt;br /&gt;
	local fs = args[&amp;#039;font-size&amp;#039;] or &amp;#039;88%&amp;#039;&lt;br /&gt;
	local text = args[&amp;#039;text&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local margin = args[&amp;#039;margin&amp;#039;] or &amp;#039;auto&amp;#039;&lt;br /&gt;
	local border = ( bw &amp;gt; 0 ) and tostring(bw) .. &amp;#039;px #aaa solid&amp;#039; or nil&lt;br /&gt;
&lt;br /&gt;
	-- find all the nonempty image numbers&lt;br /&gt;
	local imagenums = {}&lt;br /&gt;
	local imagecount = 0&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		local i = tonumber(tostring(k):match( &amp;#039;^%s*image([%d]+)%s*$&amp;#039; ) or &amp;#039;0&amp;#039;)&lt;br /&gt;
		if( i &amp;gt; 0 and isnotempty(v) ) then&lt;br /&gt;
			table.insert( imagenums, i )&lt;br /&gt;
			imagecount = imagecount + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- sort the image numbers&lt;br /&gt;
	table.sort(imagenums)&lt;br /&gt;
	&lt;br /&gt;
	-- compute the number of rows&lt;br /&gt;
	local rowcount = math.ceil(imagecount / perrow)&lt;br /&gt;
	&lt;br /&gt;
	if rowcount &amp;lt; 1 then&lt;br /&gt;
		return &amp;#039;[[Category:Pages using image array with no images]]&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- start table&lt;br /&gt;
	root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	root&lt;br /&gt;
		:addClass(args[&amp;#039;class&amp;#039;])&lt;br /&gt;
		:css(&amp;#039;border-collapse&amp;#039;,&amp;#039;collapse&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;,&amp;#039;center&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-size&amp;#039;, fs)&lt;br /&gt;
		:css(&amp;#039;line-height&amp;#039;,&amp;#039;1.25em&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;margin&amp;#039;,margin)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, tostring(width*perrow) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- loop over the images&lt;br /&gt;
	for j = 1, rowcount do&lt;br /&gt;
		local row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;top&amp;#039;)&lt;br /&gt;
		for k = 1, perrow do&lt;br /&gt;
			i = imagenums[(j-1)*perrow + k] or 0&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, width .. &amp;#039;px&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
				:css(border and &amp;#039;border&amp;#039; or &amp;#039;&amp;#039;, border or &amp;#039;&amp;#039;)&lt;br /&gt;
				:wikitext(renderArrayCell( &lt;br /&gt;
					args[&amp;#039;image&amp;#039; .. i], args[&amp;#039;caption&amp;#039; .. i], args[&amp;#039;alt&amp;#039; .. i], &lt;br /&gt;
					args[&amp;#039;border&amp;#039; .. i], args[&amp;#039;link&amp;#039; .. i] , &lt;br /&gt;
					args[&amp;#039;text&amp;#039;], args[&amp;#039;text&amp;#039; .. i] , width, height)&lt;br /&gt;
					)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
	-- end table&lt;br /&gt;
    return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
function p.array( frame )&lt;br /&gt;
    return imagearray( frame )&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>JavaSkeptre</name></author>
	</entry>
</feed>