Anonymous user
Module:String2: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
fetch parent args
(upgrade posnq - Now supports named parameters: source, target, plain, nomatch; and UTC) |
(fetch parent args) |
||
Line 110:
-- any double quotes " are stripped out.
p.posnq = function(frame)
local
local pargs = frame:getParent().args
local match = mw.text.trim(frame.args[2] or frame.args.target or ""):gsub('"', '')▼
for k, v in pairs(pargs) do
local plain = mw.text.trim(frame.args[3] or frame.args.plain or "")▼
args[k] = v
end
local str = mw.text.trim(args[1] or args.source or "")
if plain == "false" then plain = false else plain = true end
local nomatch = mw.text.trim(
▲ if str == "" or match == "" then return nil end
-- just take the start position
local pos = mw.ustring.find(str, match, 1, plain) or nomatch
|