Module:Ustring

From Zoophilia Wiki
Revision as of 01:03, 7 June 2021 by Quantumhusky (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Documentation for this module may be created at Module:Ustring/doc

require('Module:No globals')
return setmetatable({}, {
	__index = function(t, k)
		local what = mw.ustring[k]
		if type(what) ~= "function" then
			return what
		end
		return function(frame)
			local args = frame.args
			for _, v in ipairs(args) do
				args[_] = tonumber(v) or v:gsub("^\\", "", 1)
			end
			if not args.tag then
				return (what(unpack(args)))
			end
			local tagargs = {}
			for x, y in pairs(args) do
				if type(x) ~= 'number' and x ~= 'tag' then tagargs[x] = y end
			end
			return frame:extensionTag{name = args.tag, content = what(unpack(args)), args = tagargs}
		end
	end
})