No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {}; | local p = {}; | ||
local cargo = mw.ext.cargo | |||
local tables = 'MoveDataCargoTest' | |||
p.fields = 'id,input,target,damage,startup' | |||
p.queryOverride = function(frame) | p.queryOverride = function(frame) | ||
Line 7: | Line 11: | ||
return "Error: no id" | return "Error: no id" | ||
end | end | ||
local root = mw.html.create('div') | local root = mw.html.create('div') | ||
for k,v in pairs( | for k, v in pairs(cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })) do | ||
root:node(mw.html.create('div'):wikitext(k .. ": " .. v)) | root:node(mw.html.create('div'):wikitext(k .. ": " .. v)) | ||
end | end | ||
return root | return root | ||
end | end | ||
return p | return p |
Revision as of 22:49, 21 August 2023
Documentation for this module may be created at Module:Move7/doc
local p = {};
local cargo = mw.ext.cargo
local tables = 'MoveDataCargoTest'
p.fields = 'id,input,target,damage,startup'
p.queryOverride = function(frame)
local args = frame:getParent().args
local id = args['id']
if id == nil then
return "Error: no id"
end
local root = mw.html.create('div')
for k, v in pairs(cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })) do
root:node(mw.html.create('div'):wikitext(k .. ": " .. v))
end
return root
end
return p