<?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%3Atable%2FgetMetamethod</id>
	<title>Module:table/getMetamethod - 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%3Atable%2FgetMetamethod"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;action=history"/>
	<updated>2026-05-23T05:30:59Z</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:table/getMetamethod&amp;diff=474959&amp;oldid=prev</id>
		<title>Sware: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;diff=474959&amp;oldid=prev"/>
		<updated>2025-11-04T17:47:25Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:47, 4 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;diff=459873&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local table_get_unprotected_metatable = &quot;Module:table/getUnprotectedMetatable&quot;  local rawget = rawget local select = select  local function get_unprotected_metatable(...) 	get_unprotected_metatable = require(table_get_unprotected_metatable) 	return get_unprotected_metatable(...) end  local function get_metamethod(n, i, mt, mm, ...) 	if mt then 		mm = rawget(mt, mm) 	else 		mm = nil 	end 	if i == n then 		return mm 	end 	return mm, get_metamethod(n, i + 1, mt, ...) end  -...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;diff=459873&amp;oldid=prev"/>
		<updated>2025-06-28T09:14:13Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local table_get_unprotected_metatable = &amp;quot;Module:table/getUnprotectedMetatable&amp;quot;  local rawget = rawget local select = select  local function get_unprotected_metatable(...) 	get_unprotected_metatable = require(table_get_unprotected_metatable) 	return get_unprotected_metatable(...) end  local function get_metamethod(n, i, mt, mm, ...) 	if mt then 		mm = rawget(mt, mm) 	else 		mm = nil 	end 	if i == n then 		return mm 	end 	return mm, get_metamethod(n, i + 1, mt, ...) end  -...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:14, 28 June 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;diff=474958&amp;oldid=prev</id>
		<title>wikt&gt;Theknightwho at 17:47, 9 May 2025</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:table/getMetamethod&amp;diff=474958&amp;oldid=prev"/>
		<updated>2025-05-09T17:47:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local table_get_unprotected_metatable = &amp;quot;Module:table/getUnprotectedMetatable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local rawget = rawget&lt;br /&gt;
local select = select&lt;br /&gt;
&lt;br /&gt;
local function get_unprotected_metatable(...)&lt;br /&gt;
	get_unprotected_metatable = require(table_get_unprotected_metatable)&lt;br /&gt;
	return get_unprotected_metatable(...)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_metamethod(n, i, mt, mm, ...)&lt;br /&gt;
	if mt then&lt;br /&gt;
		mm = rawget(mt, mm)&lt;br /&gt;
	else&lt;br /&gt;
		mm = nil&lt;br /&gt;
	end&lt;br /&gt;
	if i == n then&lt;br /&gt;
		return mm&lt;br /&gt;
	end&lt;br /&gt;
	return mm, get_metamethod(n, i + 1, mt, ...)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Takes an input value and any number of metamethods, and attempts to retrieve the values at those keys in the value&amp;#039;s metatable. Returns a boolean stating whether the value&amp;#039;s metamethods are findable, followed by a return value for each metamethod.&lt;br /&gt;
&lt;br /&gt;
A value&amp;#039;s metamethods are findable if it does not have a protected metatable, so the first return value is {true} if the value either has a metatable which does not contain the {__metatable} metamethod, or it has no metatable at all. If the value does have a protected metatable, the first return value is {false}, and all remaining return values default to {nil}.]==]&lt;br /&gt;
return function(t, ...)&lt;br /&gt;
	local mt, n = get_unprotected_metatable(t), select(&amp;quot;#&amp;quot;, ...)&lt;br /&gt;
	-- get_unprotected_metatable() returns the metatable if it&amp;#039;s unprotected,&lt;br /&gt;
	-- false if it&amp;#039;s protected, or nil if there is no metatable. It checks&lt;br /&gt;
	-- whether a metatable is protected by trying pcall(setmetatable, t),&lt;br /&gt;
	-- so it&amp;#039;s always possible to determine accurately.&lt;br /&gt;
	if n == 0 then&lt;br /&gt;
		return mt ~= false&lt;br /&gt;
	end&lt;br /&gt;
	return mt ~= false, get_metamethod(n, 1, mt, ...)&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>wikt&gt;Theknightwho</name></author>
	</entry>
</feed>