Module:SS Medals

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:SS Medals/doc

local p = {}

-- Load required modules
local json = require("json")
local mw = require("mw")

-- Function to load JSON data
local function loadData()
    local jsonText = mw.ext.data.get("JoJo Wiki:SS Medals")
    return json.decode(jsonText)
end

-- Function to get title by ID
function p.getTitleById(frame)
    local id = tonumber(frame.args[1]) or error("ID not provided or invalid")
    local data = loadData()
    if not data[id] then
        return "No entry found for ID " .. id
    end
    return data[id].title
end

return p