<?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%3Afun%2FisCallable</id>
	<title>Module:fun/isCallable - 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%3Afun%2FisCallable"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:fun/isCallable&amp;action=history"/>
	<updated>2026-04-06T02:52:14Z</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:fun/isCallable&amp;diff=459875&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local table_get_metamethod_module = &quot;Module:table/getMetamethod&quot;  local require = require local type = type  local function get_metamethod(...) 	get_metamethod = require(table_get_metamethod_module) 	return get_metamethod(...) end  --[==[ Return {true} if the input is a function or functor (an object which can be called like a function, because it has a {__call} metamethod).  Note: if the input is an object with a {__call} metamethod, but this function is not able to fin...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:fun/isCallable&amp;diff=459875&amp;oldid=prev"/>
		<updated>2025-06-28T09:15:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local table_get_metamethod_module = &amp;quot;Module:table/getMetamethod&amp;quot;  local require = require local type = type  local function get_metamethod(...) 	get_metamethod = require(table_get_metamethod_module) 	return get_metamethod(...) end  --[==[ Return {true} if the input is a function or functor (an object which can be called like a function, because it has a {__call} metamethod).  Note: if the input is an object with a {__call} metamethod, but this function is not able to fin...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local table_get_metamethod_module = &amp;quot;Module:table/getMetamethod&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local require = require&lt;br /&gt;
local type = type&lt;br /&gt;
&lt;br /&gt;
local function get_metamethod(...)&lt;br /&gt;
	get_metamethod = require(table_get_metamethod_module)&lt;br /&gt;
	return get_metamethod(...)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Return {true} if the input is a function or functor (an object which can be called like a function, because it has a {__call} metamethod).&lt;br /&gt;
&lt;br /&gt;
Note: if the input is an object with a {__call} metamethod, but this function is not able to find it because the object&amp;#039;s metatable is protected with {__metatable}, then it will return {false} by default, or {nil} if the {allow_maybe} flag is set.]==]&lt;br /&gt;
return function(obj, allow_maybe)&lt;br /&gt;
	if type(obj) == &amp;quot;function&amp;quot; then&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	-- An object is callable if it has a __call metamethod, so try to get it&lt;br /&gt;
	-- with get_metamethod().&lt;br /&gt;
	local success, __call = get_metamethod(obj, &amp;quot;__call&amp;quot;)&lt;br /&gt;
	-- If this succeeds, `obj` will only be callable if the __call metamethod is&lt;br /&gt;
	-- a function (i.e. it can&amp;#039;t itself be a callable table), so don&amp;#039;t recurse&lt;br /&gt;
	-- to check it.&lt;br /&gt;
	if __call and type(__call) == &amp;quot;function&amp;quot; then&lt;br /&gt;
		return true&lt;br /&gt;
	-- If not, then the metatable is protected, so it&amp;#039;s not possible to know if&lt;br /&gt;
	-- `obj` is callable without actually calling it.&lt;br /&gt;
	elseif not success then&lt;br /&gt;
		if allow_maybe then&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>