Module:Move7: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
No edit summary
No edit summary
Line 12: Line 12:
end
end
local root = mw.html.create('div')
local result = cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })[0]
for rowName, row in pairs(cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })) do
for k, v in pairs(result) do
local rowNode = mw.html.create('div'):wikitext('row: ' .. rowName)
local override
root:node(rowNode)
if k == 'id' then
for k, v in pairs(row) do
override = args['overrideId']
rowNode:node(mw.html.create('div'):wikitext(k .. ": " .. v))
else
override = args[k]
end
if override ~= nil then
result[k] = override
end
end
end
end
return root
local templateParams = ''
for k, v in pairs(result) do
templateParams = templateParams .. '|' .. k .. '=' .. v
end
return templateParams
end
end


return p
return p

Revision as of 10:40, 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,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 result = cargo.query(tables, p.fields, { where = "id = '" .. id .. "'" })[0]
	for k, v in pairs(result) do
		local override
		if k == 'id' then
			override = args['overrideId']
		else
			override = args[k]
		end
		
		if override ~= nil then
			result[k] = override
		end
	end
	
	local templateParams = ''
	for k, v in pairs(result) do
		templateParams = templateParams .. '|' .. k .. '=' .. v
	end
	return templateParams
end

return p