Module:ModuleLevelTable

From The First Descendant Wiki
Revision as of 02:56, 4 June 2024 by Software2 (talk | contribs)

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

local p = {}

function p.loadJson(frame)
    -- Get the JSON string from the template parameter named 'json'
    local jsonString = frame.args.json

    -- Parse the JSON string into a Lua table
    local success, jsonTable = pcall(mw.text.jsonDecode, jsonString)

    if success then
        return jsonTable
    else
        return "Error parsing JSON"
    end
end

return p