More actions
Created page with "local p = {} local http = require('socket.http') local json = require('dkjson') function p.getVersion(frame) local url = 'https://api.vaulthunters.gg/patch-notes?limit=1' -- Fetch the data local body, status = http.request(url) if status ~= 200 then return 'Error fetching version data' end -- Parse JSON local data, pos, err = json.decode(body) if err then return 'Error parsing JSON: ' .. err end..." |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p. | function p.formatVersion(frame) | ||
local | local version = frame.args[1] or frame:getParent().args[1] or "" | ||
if version == "" then | |||
return "No version provided" | |||
return | |||
end | end | ||
-- | -- Remove patch version (everything after the last dot) | ||
local | local majorMinor = version:match("^(.+)%.") | ||
if majorMinor then | |||
if | return "3." .. majorMinor | ||
else | else | ||
return | return "3." .. version | ||
end | end | ||
end | end | ||
return p | return p |
Latest revision as of 18:03, 15 July 2025
Documentation for this module may be created at Module:VHVersion/doc
local p = {}
function p.formatVersion(frame)
local version = frame.args[1] or frame:getParent().args[1] or ""
if version == "" then
return "No version provided"
end
-- Remove patch version (everything after the last dot)
local majorMinor = version:match("^(.+)%.")
if majorMinor then
return "3." .. majorMinor
else
return "3." .. version
end
end
return p