Module:Ustring: Difference between revisions

Content deleted Content added
maintain error messages
Can you not reinvent the wheel?
Line 1:
require('Module:No globals')
return setmetatable({}, {
__index = function(t, fk)
iflocal nilwhat == mw.ustring[fk] then
if type(what) ~= "function" then
return what
end
return function(frame)
if nil == mw.ustring[f] then
return '<strong class="error">'..mw.message.new('scribunto-common-nosuchfunction', '', f):plain()..'</strong>'
end
if 'function' ~= type(mw.ustring[f]) then
return '<strong class="error">'..mw.message.new('scribunto-common-notafunction', '', f):plain()..'</strong>'
end
local args = frame.args
for i_, v in ipairs(args) do
args[i_] = tonumber(v) or v:gsub("^\\", "", 1)
end
if args.tag then
local tag = {name = args.tag, content = mw.ustring[k](unpack(args)), args = {}}
local tagargs = {}
for kx, vy in pairs(args) do
if 'number' ~= type(kx) and~= 'tagnumber' and x ~= k'tag' then tagargstag.args[kx] = vy end
end
return frame:extensionTag{name = args.(tag, content = mw.ustring[f](unpack(args)), args = tagargs}
end
return (mw.ustring[fk](unpack(args)))
end
end