Module:Move7: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
No edit summary
No edit summary
Line 7: Line 7:
p.queryOverride = function(frame)
p.queryOverride = function(frame)
local args = frame:getParent().args
local args = frame:getParent().args
local id = args['id']
local id = args[1]
if id == nil then
if id == nil then
return "Error: no id"
return "Error: no id"
Line 14: Line 14:
local result = cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })[1]
local result = cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })[1]
for k, v in pairs(result) do
for k, v in pairs(result) do
local override
local override = args[k]
if k == 'id' then
override = args['overrideId']
else
override = args[k]
end
if override ~= nil then
if override ~= nil then
result[k] = override
result[k] = override

Revision as of 11:31, 22 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,name,input,target,damage,reach,tracksLeft,tracksRight,startup,recv,tot,crush,block,hit,ch,notes'

p.queryOverride = function(frame)
	local args = frame:getParent().args
	local id = args[1]
	if id == nil then
		return "Error: no id"
	end
	
	local result = cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })[1]
	for k, v in pairs(result) do
		local override = args[k]
		if override ~= nil then
			result[k] = override
		end
	end
	
	return frame:expandTemplate{ title = 'MoveDataCargoTest/Display', args = result }
end

return p