Module:ExtractOldid

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
[edit] Documentation

Usage

[edit]

Extracts the Oldid from an URL.

{{#invoke:ExtractOldid|getOldid|evaluated-url=HTTPS://SOMEURL&oldid=1234567}}

Returns: 1234567

See also

[edit]
-- Module:ExtractOldid
local p = {}

function p.getOldid(frame)
    local url = frame.args['evaluated-url']
    if not url then
        return "URL not provided"
    end
    local oldid = url:match("oldid=(%d+)")
    if oldid then
        return oldid
    else
        return "oldid not found"
    end
end

return p