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 = {}

function p.getTitle(id)
    -- Load JSON data from the page "JoJo Wiki:SS Medals"
    local jsonData = mw.title.new("JoJo Wiki:SS Medals"):getContent()
    
    -- Parse JSON data
    local data = mw.text.jsonDecode(jsonData)
    
    -- Search for the entry with the given ID
    for _, entry in ipairs(data) do
        if entry.id == id then
            return entry.title
        end
    end
    
    return nil
end

return p