Jump to content

Module:Data/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pppery (talk | contribs) at 00:51, 6 April 2020 (Undid revision 947738882 by 2A01:CB04:4AC:2300:1975:F518:CB7A:FA9 (talk) CLearly not an attempt at sandboxing a change to Module:Data). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local mt = {}

function mt.__index(t, k)
	if string.sub(k, 1, 7) ~= "Module:" then
		k = "Module:" .. k
	end
	return function(frame)
		local data = mw.loadData(k)
		for _,v in ipairs(frame.args) do
			data = data[v]
		end
		return data
	end
end

return setmetatable({}, mt)