<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AIs_instance</id>
	<title>Module:Is instance - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AIs_instance"/>
	<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Is_instance&amp;action=history"/>
	<updated>2026-04-04T21:13:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://the-democratika.com/wiki/index.php?title=Module:Is_instance&amp;diff=8957&amp;oldid=prev</id>
		<title>&gt;MusikBot II: Changed protection settings for &quot;Module:Is instance&quot;: High-risk template or module: 8007 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Is_instance&amp;diff=8957&amp;oldid=prev"/>
		<updated>2022-09-13T18:01:44Z</updated>

		<summary type="html">&lt;p&gt;Changed protection settings for &amp;quot;&lt;a href=&quot;/wiki/index.php/Module:Is_instance&quot; title=&quot;Module:Is instance&quot;&gt;Module:Is instance&lt;/a&gt;&amp;quot;: &lt;a href=&quot;https://en.wikipedia.org/wiki/High-risk_templates&quot; class=&quot;extiw&quot; title=&quot;wikipedia:High-risk templates&quot;&gt;High-risk template or module&lt;/a&gt;: 8007 transclusions (&lt;a href=&quot;/wiki/index.php?title=User:MusikBot_II/TemplateProtector&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:MusikBot II/TemplateProtector (page does not exist)&quot;&gt;more info&lt;/a&gt;) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))&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;
local function checklayer(depth) -- check subclasses of items at current depth&lt;br /&gt;
	checklist[depth+1] = {} -- setup next layer of table&lt;br /&gt;
	local j = 0&lt;br /&gt;
	for j = 1,#checklist[depth] do -- loop over items at current depth&lt;br /&gt;
		local property&lt;br /&gt;
		if depth == 1 then&lt;br /&gt;
			property = &amp;quot;P31&amp;quot; -- use P31 for depth 1&lt;br /&gt;
		else&lt;br /&gt;
			property = &amp;quot;P279&amp;quot; -- use P279 for depths 2+&lt;br /&gt;
		end&lt;br /&gt;
		local subclasses = mw.wikibase.getBestStatements(checklist[depth][j],property) -- get P31 or P279 statements&lt;br /&gt;
		for i,statement in ipairs(subclasses) do -- loop through items at next depth&lt;br /&gt;
			if statement.mainsnak.snaktype == &amp;#039;value&amp;#039; then&lt;br /&gt;
				local newitem = statement.mainsnak.datavalue.value.id&lt;br /&gt;
				if newitem == value then&lt;br /&gt;
					isInstance = true&lt;br /&gt;
				else&lt;br /&gt;
					checklist[depth+1][#checklist[depth+1]+1] = newitem -- add item to next depth of checklist table&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return isInstance&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local pargs = frame:getParent().args&lt;br /&gt;
	value = args.value or pargs.value&lt;br /&gt;
	local qid = args.qid or pargs.qid or &amp;quot;&amp;quot;&lt;br /&gt;
	if qid == &amp;quot;&amp;quot; then&lt;br /&gt;
		qid = mw.wikibase.getEntityIdForCurrentPage()&lt;br /&gt;
	end&lt;br /&gt;
	if not qid then&lt;br /&gt;
		return 0&lt;br /&gt;
	end&lt;br /&gt;
	checklist = {{qid}}&lt;br /&gt;
	local md = args.maxdepth or pargs.maxdepth&lt;br /&gt;
	if md then&lt;br /&gt;
		maxdepth = tonumber(md)&lt;br /&gt;
	else&lt;br /&gt;
		maxdepth = 5&lt;br /&gt;
	end&lt;br /&gt;
	depth = 0 -- current depth&lt;br /&gt;
	isInstance = false -- assume false until match found&lt;br /&gt;
	while not isInstance and depth&amp;lt;maxdepth do&lt;br /&gt;
		depth = depth+1&lt;br /&gt;
		checklayer(depth)&lt;br /&gt;
	end&lt;br /&gt;
	if not isInstance then&lt;br /&gt;
		depth = 0 -- indicates not isInstance&lt;br /&gt;
	end&lt;br /&gt;
	return depth -- return depth that item was found&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>&gt;MusikBot II</name></author>
	</entry>
</feed>