Jump to content

Module:Strip version patch

From Calamity Wiki
Revision as of 14:22, 30 July 2025 by imported>The RedBurn (←Created page with '-- Strip only third component (patch) of a software version if present -- For instance 6.16.1 as parameter will return 6.16 -- Used on Linux kernel version history local p = {} function p.main(frame) local version = frame.args[1] or '' local cleaned = mw.ustring.gsub(version, "^(%d+%.%d+)%.%d+$", "%1") return cleaned end return p')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Usage

{{#invoke:Strip version patch|main|value}}



-- Strip only third component (patch) of a software version if present
-- For instance 6.16.1 as parameter will return 6.16
-- Used on [[Linux kernel version history]]
local p = {}

function p.main(frame)
    local version = frame.args[1] or ''
    local cleaned = mw.ustring.gsub(version, "^(%d+%.%d+)%.%d+$", "%1")
    return cleaned
end

return p