Module:VisualData: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Reverted |
No edit summary |
||
(16 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
function p.query(frame) | function p.query(frame) | ||
local query = frame.args[1] | |||
local params = {} | |||
for k, v in pairs(frame.args) do | |||
if k ~= 0 then | |||
table.insert(params, k .. "=" .. v) | |||
end | |||
end | |||
return | local success, result = pcall(function() | ||
return mw.ext.visualdata.query(query, params) | |||
end) | |||
if not success then | |||
return "Error: " .. tostring(result) | |||
end | |||
return result | |||
end | end | ||
return | return p |
Latest revision as of 09:55, 4 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 ~= 0 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 "Error: " .. tostring(result)
end
return result
end
return p