Module:Arcana list

local p = {}

function p.arcanaList(frame) local args = frame

if frame == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else frame = mw.getCurrentFrame end local argsOr = {} local argsAnd = {} local pool = "" for key, value in pairs(args) do		if string.sub(key,1,3) == "or_" then argsOr[#argsOr+1] = string.sub(key,4) .. ' = "' .. value .. '"' elseif string.sub(key,1,3) == "and" then argsAnd[#argsAnd+1] = string.sub(key,4) .. ' = "' .. value .. '"' elseif key == "pool" then pool = value end end local cargoOr = table.concat(argsOr, " OR ") local cargoAnd = table.concat(argsAnd, " AND ") local cargowhere = "" if cargoOr == "" then cargowhere = "(" .. cargoAnd .. ")" elseif cargoAnd == "" then cargowhere = "(" .. cargoOr .. ")" else cargowhere = "(" .. cargoOr .. ") OR (" .. cargoAnd .. ")" end if pool ~= "" then cargowhere = "(" .. cargowhere .. ") AND pool = " .. value end local fieldslist = { "name", "description", "element", "type", "subtypes", "damage", "cooldown", "knockback", "duration", "gemCost", "goldCost", "pool" }	local cargofields = table.concat(fieldslist, ',') local result = mw.ext.cargo.query("Arcana",		cargofields,		{			where = cargowhere		}	) for _, row in ipairs(result) do		-- todo end local output = ..result.. return output end

return p