Module:User:Njardarlogar/editor

This is a private module sandbox of Njardarlogar, for their own experimentation. Items in this module may be added and removed at Njardarlogar's discretion; do not rely on this module's stability.


local p = {}

error_module = require('Module:error message')
errormsg = error_module.main

function p.main(frame, out, in_)
    if out == nil or in_ == nil then
        return errormsg('Use the module the following way: {{#invoke:User:Njardarlogar/editor|main|<text to be replaced>|<text to be inserted instead>}}')
    end
    args = frame.args
    title = args[1]
    text = frame:expandTemplate{title = title}
    text = text:gsub(out, in_)
    return text
end

return p