Content deleted Content added
maintain error messages |
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)) |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1:
require('
return setmetatable({}, {
__index = function(t,
local what = mw.ustring[k]
if type(what) ~= "function" then
return what
return function(frame)
local fargsused = { tag = true }
while fargs['s' .. str_i] do
fargsused['s' .. str_i] = true
args[str_i] = fargs['s' .. str_i]
str_i = str_i + 1
end
fargsused[i] = true
args[i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)▼
end
if not fargs.tag then
▲ local args = frame.args
return (what(unpack(args))) -- Outside parens truncate to first result avoiding tail call
▲ for i, v in ipairs(args) do
▲ args[i] = tonumber(v) or v:gsub("^\\", "", 1)
end
▲ local tagargs = {}
▲ for k, v in pairs(args) do
▲ if 'number' ~= type(k) and 'tag' ~= k then tagargs[k] = v end
▲ end
end
return
end
end
|