Module:Ustring: Difference between revisions

Content deleted Content added
to consolidate common function to Module:LuaCall, for ease to maintain bug fix and improvement. Some bug fixes and improvements has been done there but not yet here. One of common functions like tostringOrNumber() will also be shared there. This is not proxying, but to share common code with other modules.
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))
 
(11 intermediate revisions by 6 users not shown)
Line 1:
require('strict')
local p = require("Module:LuaCall").import(mw.ustring)
return setmetatable({}, {
 
p[k]__index = function(framet, k)
for k, v in pairs(p) do
local what = mw.ustring[k]
p[k] = function(frame)
if type(what) ~= "function" then
local args = frame.args
return pwhat
--for _, v in ipairs(args) do
--end
-- args[_] = tonumber(v) or v:gsub("^\\", "", 1)
return (vfunction(frame))
--end
local argsfargs = frame.args
if args.tag then
local tagfargsused = {name = args.tag, content = v(frame),true args = {}}
local args = {}
for x, y in pairs(args) do
local str_i = 1
if type(x)~='number' and x~='tag' then tag.args[x] = y end
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
fargsused[i] = true
-- args[_i + str_i - 1] = tonumber(v) or v:gsub("^\\", "", 1)
end
if argsnot fargs.tag then
return (what(unpack(args))) -- Outside parens truncate to first result avoiding tail call
end
local tagargs = {}
for kx, vy in pairs(pfargs) do
if not fargsused[x] then tagargs[x] = y end
end
return frame:extensionTag({name = fargs.tag, content = what(unpack(args)), args = tagargs}
end
return (v(frame))
end
})
end
 
return p