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.getData(frame)
    -- Load JSON data directly from the page "JoJo Wiki:SS Medals"
    local data = mw.loadJsonData('JoJo Wiki:SS Medals')
    
    -- Retrieve the ID and parameter to return from the passed frame arguments
    local id = frame.args[1]
    local param = frame.args[2] -- Parameter to return (e.g., title, rarity, character)
    
    -- Check if data for the given ID exists and the parameter is valid
    if data[id] and data[id][param] then
        return tostring(data[id][param]) -- Convert to string if necessary
    else
        return "N/A"
    end
end

return p