<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FGalobtter%2FRelated_changes</id>
	<title>Module:Sandbox/Galobtter/Related changes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FGalobtter%2FRelated_changes"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Galobtter/Related_changes&amp;action=history"/>
	<updated>2026-05-27T13:20:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Galobtter/Related_changes&amp;diff=145453&amp;oldid=prev</id>
		<title>imported&gt;Plastikspork: Plastikspork moved page Module:Related changes to Module:Sandbox/Galobtter/Related changes without leaving a redirect: Per TfD outcome</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Galobtter/Related_changes&amp;diff=145453&amp;oldid=prev"/>
		<updated>2019-01-28T23:48:59Z</updated>

		<summary type="html">&lt;p&gt;Plastikspork moved page &lt;a href=&quot;/index.php?title=Module:Related_changes&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Related changes (page does not exist)&quot;&gt;Module:Related changes&lt;/a&gt; to &lt;a href=&quot;/research/Module:Sandbox/Galobtter/Related_changes&quot; title=&quot;Module:Sandbox/Galobtter/Related changes&quot;&gt;Module:Sandbox/Galobtter/Related changes&lt;/a&gt; without leaving a redirect: Per TfD outcome&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p={}&lt;br /&gt;
&lt;br /&gt;
function getParam(frame)&lt;br /&gt;
    -- This is a longwinded way to return all the args (first choice) or parent.args (second choice) in an array.&lt;br /&gt;
    local parent, pargs, args&lt;br /&gt;
    local param={}&lt;br /&gt;
    parent = frame[&amp;#039;parent&amp;#039;]&lt;br /&gt;
    if (parent) then&lt;br /&gt;
        pargs = parent[&amp;#039;args&amp;#039;]&lt;br /&gt;
    end&lt;br /&gt;
    if (pargs) then&lt;br /&gt;
        for k,v in pairs(args) do&lt;br /&gt;
            param[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    args = frame[&amp;#039;args&amp;#039;]&lt;br /&gt;
    if (args) then&lt;br /&gt;
        for k,v in pairs(args) do&lt;br /&gt;
            param[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return param&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function getIndexpage(page)&lt;br /&gt;
	-- get the contents of either the current page (inadvisable...) or a specified page&lt;br /&gt;
	-- returns either a title object or an error string, and a boolean true for successful completion&lt;br /&gt;
	local indexpage&lt;br /&gt;
    if (page) then&lt;br /&gt;
        indexpage = mw.title.new(page)&lt;br /&gt;
        if (not(indexpage)) then&lt;br /&gt;
            return &amp;#039;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;[[Module:Related changes]] error: failed to access page: [[&amp;#039; + tostring(page) + &amp;#039;]]&amp;lt;/span&amp;gt;&amp;#039;,false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        indexpage = mw.title.getCurrentTitle()&lt;br /&gt;
        if (not(indexpage)) then&lt;br /&gt;
            return &amp;#039;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;[[Module:Related changes]] bug: failed to access getCurrentTitle!&amp;lt;/span&amp;gt;&amp;#039;,false&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return indexpage, true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function getLinks(frame,indexpage)&lt;br /&gt;
	local index = indexpage:getContent() or &amp;quot;&amp;quot; -- indexpage should exist, so no further checking for errors, just return blank&lt;br /&gt;
	local nextLink = mw.ustring.gmatch(index,&amp;quot;%[%[([^%]|]+)[^%]]-%]%]&amp;quot;)&lt;br /&gt;
	local linklist = {}&lt;br /&gt;
	for link in nextLink do&lt;br /&gt;
		local linkval = frame:callParserFunction(&amp;#039;REVISIONTIMESTAMP&amp;#039;, link)&lt;br /&gt;
		if (mw.ustring.len(linkval) &amp;gt; 8) then -- don&amp;#039;t even index pages that don&amp;#039;t get meaningful results&lt;br /&gt;
            linklist[tostring(link)] = linkval .. &amp;#039;|&amp;#039; .. frame:callParserFunction(&amp;#039;REVISIONUSER&amp;#039;, link)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return linklist&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function display(linklist, options)&lt;br /&gt;
	if (not(options)) then&lt;br /&gt;
		options = &amp;#039;d-&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local sorttype = mw.ustring.match(options,&amp;#039;([%l%u])&amp;#039;)&lt;br /&gt;
    local sortdir = mw.ustring.match(options,&amp;#039;([%+%-])&amp;#039;)&lt;br /&gt;
	if (sorttype == &amp;#039;n&amp;#039;) then&lt;br /&gt;
		sorttype = &amp;#039;name&amp;#039;&lt;br /&gt;
		if (sortdir == &amp;#039;-&amp;#039;) then&lt;br /&gt;
			sortdir = &amp;#039;descending&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			sortdir = &amp;#039;ascending&amp;#039;&lt;br /&gt;
	    end&lt;br /&gt;
    else&lt;br /&gt;
	    sorttype = &amp;#039;date&amp;#039;&lt;br /&gt;
	    if (sortdir == &amp;#039;+&amp;#039;) then&lt;br /&gt;
			sortdir = &amp;#039;ascending&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			sortdir = &amp;#039;descending&amp;#039;&lt;br /&gt;
	    end&lt;br /&gt;
	end&lt;br /&gt;
	local outsort, outarray = {}, {&amp;#039;{| class=&amp;quot;wikitable sortable&amp;quot;\n!Name\n!Last edited\n!Last editor&amp;#039;}&lt;br /&gt;
	for k,v in pairs(linklist) do&lt;br /&gt;
		if sorttype == &amp;#039;name&amp;#039; then&lt;br /&gt;
    	    table.insert(outsort, k..&amp;#039;|&amp;#039;..v)&lt;br /&gt;
    	else&lt;br /&gt;
    		table.insert(outsort, v..&amp;#039;|&amp;#039;..k)&lt;br /&gt;
        end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(outsort)&lt;br /&gt;
	for i = 1,#outsort do&lt;br /&gt;
		local n, d, u, split&lt;br /&gt;
		split = mw.text.split(outsort[i],&amp;#039;|&amp;#039;,true)&lt;br /&gt;
		if sorttype == &amp;#039;name&amp;#039; then&lt;br /&gt;
		    n, d, u= split[3], split[1], split[2]&lt;br /&gt;
        else&lt;br /&gt;
    	    d, u, n = split[1], split[2], split[3]&lt;br /&gt;
    	end&lt;br /&gt;
    	if ((mw.ustring.sub(n, 1, 5) == &amp;#039;File:&amp;#039;) or (mw.ustring.sub(n, 1, 6) == &amp;#039;Image:&amp;#039;)) then&lt;br /&gt;
    		n = &amp;#039;:&amp;#039; .. n&lt;br /&gt;
    	end&lt;br /&gt;
		table.insert(outarray,&amp;#039;\n|-\n|[[&amp;#039;..(n or &amp;#039;[[Module:Related changes]] bug: missing name&amp;#039;) .. &amp;#039;]]\n|&amp;#039; .. (d or &amp;#039;[[Module:Related changes]] bug: missing date&amp;#039;) .. &amp;#039;\n|[[User:&amp;#039; .. u .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	table.insert(outarray,&amp;#039;\n|}&amp;#039;)&lt;br /&gt;
	return table.concat(outarray)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function filter(linklist, action)&lt;br /&gt;
	-- pass&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
&lt;br /&gt;
    local param = getParam(frame) -- get all parameters in param tabel; args override parent.args&lt;br /&gt;
    local indexpage = getIndexpage(param.page)&lt;br /&gt;
    local linklist = getLinks(frame,indexpage)&lt;br /&gt;
    for operation = 1, #param do&lt;br /&gt;
    	filter(linklist, param[operation])&lt;br /&gt;
    end&lt;br /&gt;
    if param.nowiki then&lt;br /&gt;
    	return frame:preprocess(&amp;#039;&amp;lt;nowiki&amp;gt;&amp;#039;..display(linklist)..&amp;#039;&amp;lt;/nowiki&amp;gt;&amp;#039;)&lt;br /&gt;
    else&lt;br /&gt;
    	return display(linklist,param.options)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Plastikspork</name></author>
	</entry>
</feed>