<?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%3Aload</id>
	<title>Module:load - 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%3Aload"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:load&amp;action=history"/>
	<updated>2026-04-05T23:17:33Z</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:load&amp;diff=474919&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:load&amp;diff=474919&amp;oldid=prev"/>
		<updated>2025-11-04T17:47:19Z</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:load&amp;diff=410284&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local export = {}  local load_data = mw.loadData local loaded = package.loaded local main_loader = package.loaders[2] local require = require local setmetatable = setmetatable  local loaders, loaded_data, mt  local function get_mt() 	mt, get_mt = {__mode = &quot;kv&quot;}, nil 	return mt end  -- main_loader returns a loader function if the module exists, or nil if it doesn&#039;t. local function get_loader(modname) 	if loaders == nil then 		local loader = main_loader(modname) 		loaders...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:load&amp;diff=410284&amp;oldid=prev"/>
		<updated>2025-01-08T12:31:42Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}  local load_data = mw.loadData local loaded = package.loaded local main_loader = package.loaders[2] local require = require local setmetatable = setmetatable  local loaders, loaded_data, mt  local function get_mt() 	mt, get_mt = {__mode = &amp;quot;kv&amp;quot;}, nil 	return mt end  -- main_loader returns a loader function if the module exists, or nil if it doesn&amp;#039;t. local function get_loader(modname) 	if loaders == nil then 		local loader = main_loader(modname) 		loaders...&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 12:31, 8 January 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:load&amp;diff=474918&amp;oldid=prev</id>
		<title>wikt&gt;Theknightwho at 23:17, 15 December 2024</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:load&amp;diff=474918&amp;oldid=prev"/>
		<updated>2024-12-15T23:17:38Z</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 export = {}&lt;br /&gt;
&lt;br /&gt;
local load_data = mw.loadData&lt;br /&gt;
local loaded = package.loaded&lt;br /&gt;
local main_loader = package.loaders[2]&lt;br /&gt;
local require = require&lt;br /&gt;
local setmetatable = setmetatable&lt;br /&gt;
&lt;br /&gt;
local loaders, loaded_data, mt&lt;br /&gt;
&lt;br /&gt;
local function get_mt()&lt;br /&gt;
	mt, get_mt = {__mode = &amp;quot;kv&amp;quot;}, nil&lt;br /&gt;
	return mt&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- main_loader returns a loader function if the module exists, or nil if it doesn&amp;#039;t.&lt;br /&gt;
local function get_loader(modname)&lt;br /&gt;
	if loaders == nil then&lt;br /&gt;
		local loader = main_loader(modname)&lt;br /&gt;
		loaders = setmetatable({[modname] = loader or false}, mt or get_mt())&lt;br /&gt;
		return loader&lt;br /&gt;
	end&lt;br /&gt;
	local loader = loaders[modname]&lt;br /&gt;
	if loader == nil then&lt;br /&gt;
		loader = main_loader(modname)&lt;br /&gt;
		loaders[modname] = loader or false&lt;br /&gt;
	end&lt;br /&gt;
	return loader or nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_data(modname, loader)&lt;br /&gt;
	if loaded_data == nil then&lt;br /&gt;
		local data = load_data(modname)&lt;br /&gt;
		loaded_data = setmetatable({[loader] = data}, mt or get_mt())&lt;br /&gt;
		return data&lt;br /&gt;
	end&lt;br /&gt;
	local data = loaded_data[loader]&lt;br /&gt;
	if data == nil then&lt;br /&gt;
		data = load_data(modname)&lt;br /&gt;
		loaded_data[loader] = data&lt;br /&gt;
	end&lt;br /&gt;
	return data&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Like `require`, but returns `nil` if a module does not exist, instead of throwing an error.&lt;br /&gt;
&lt;br /&gt;
Outputs are cached, which is faster for all modules, but much faster for nonexistent modules, since `require` will attempt to use the full loader each time because loading failures don&amp;#039;t get cached.]==]&lt;br /&gt;
function export.safe_require(modname)&lt;br /&gt;
	local mod = loaded[modname]&lt;br /&gt;
	if mod == nil and get_loader(modname) then&lt;br /&gt;
		-- Call with require instead of the loader directly, as it protects against infinite loading loops.&lt;br /&gt;
		return require(modname)&lt;br /&gt;
	end&lt;br /&gt;
	return mod&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Like `mw.loadData`, but it does not generate a new table each time the same module is loaded via this function. Instead, it caches the returned data so that the same table can be returned each time, which is more efficient.]==]&lt;br /&gt;
function export.load_data(modname)&lt;br /&gt;
	return get_data(modname, get_loader(modname))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Like `export.load_data` (itself a variant of `mw.loadData`), but returns `nil` if a module does not exist, instead of throwing an error.&lt;br /&gt;
&lt;br /&gt;
Outputs are cached, which is faster for all modules, but much faster for nonexistent modules, since `mw.loadData` will attempt to use the full loader each time because loading failures don&amp;#039;t get cached.]==]&lt;br /&gt;
function export.safe_load_data(modname)&lt;br /&gt;
	local loader = get_loader(modname)&lt;br /&gt;
	if loader == nil then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	return get_data(modname, loader)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>wikt&gt;Theknightwho</name></author>
	</entry>
</feed>