Module:VisualData: Difference between revisions

From Visual Data Wiki
Jump to navigation Jump to search
No edit summary
Tag: Manual revert
No edit summary
Tag: Reverted
Line 15: Line 15:


     if not success then
     if not success then
         return "Error: " .. tostring(result)
         return "TError: " .. tostring(result)
     end
     end



Revision as of 18:46, 3 June 2024

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

local p = {}

function p.query(frame)
    local query = frame.args[1]
    local params = {}
    for k, v in pairs(frame.args) do
        if k ~= 1 then
            table.insert(params, k .. "=" .. v)
        end
    end

    local success, result = pcall(function()
        return mw.ext.visualdata.query(query, params)
    end)

    if not success then
        return "TError: " .. tostring(result)
    end

    return result
end

return p