Module:Shared: Difference between revisions

$wgPFEnableStringFunctions is false. So I guess I'll do this...
(Add function for sorting dictionaries)
($wgPFEnableStringFunctions is false. So I guess I'll do this...)
Line 457: Line 457:
return left == right
return left == right
end
end
end
function p._replace(str, searchTerm, replacementTerm)
    local escapedSearch = searchTerm:gsub("[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%1")
    local result = str:gsub(escapedSearch, replacementTerm)
   
    return result
end
function p.replace(frame)
local args = frame:getparent().args
return p._replace(
args[1],
args[2] or '',
args[3] or '')
end
end


return p
return p
2,875

edits