Module:Ustring: Difference between revisions

Content deleted Content added
m Protected "Module:Ustring": High-risk template or module (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
m Changed protection settings for "Module:Ustring": Used by fully protected Template:Str rightc -> Template:New page DYM -> Template:No article text (-> WP:CASC) ([Edit=Require administrator access] (indefinite))
 
(5 intermediate revisions by 4 users not shown)
Line 1:
require('Module:No globalsstrict')
return setmetatable({}, {
__index = function(t, k)
Line 7:
end
return function(frame)
local argsfargs = frame.args
local fargsused = { tag = true }
for _, v in ipairs(args) do
local args = {}
args[_] = tonumber(v) or v:gsub("^\\", "", 1)
local str_i = 1
while fargs['s' .. str_i] do
fargsused['s' .. str_i] = true
args[str_i] = fargs['s' .. str_i]
str_i = str_i + 1
end
for _i, v in ipairs(argsfargs) do
if not args.tag then
fargsused[i] = true
return (what(unpack(args)))
args[_i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)
end
if not argsfargs.tag then
return (what(unpack(args))) -- Outside parens truncate to first result avoiding tail call
end
local tagargs = {}
for x, y in pairs(argsfargs) do
if type(x) ~= 'number' andnot fargsused[x ~= 'tag'] then tagargs[x] = y end
end
return frame:extensionTag{name = argsfargs.tag, content = what(unpack(args)), args = tagargs}
end
end