Module:UtilsCargo

local p = {} local cargo = mw.ext.cargo local frame = mw.getCurrentFrame

function p.declare(cargoTable, fields) return frame:callParserFunction{ name = '#cargo_declare:_table=' .. cargoTable, args = fields } end

function p.attach(cargoTable) return frame:callParserFunction{ name = '#cargo_attach:' .. cargoTable } end

function p.store(cargoTable, fields) frame:callParserFunction{ name = '#cargo_store:_table=' .. cargoTable, args = fields } end

function p.all(conditions) if not conditions then return nil end local where = nil for _, condition in ipairs(conditions) do		local field = condition[1] local arg = condition[2] if arg and field and where then where = string.format("%s AND %s='%s'", where, field, arg) elseif arg and field then where = string.format("%s='%s'", field, arg) end end return where end

return setmetatable(p, {__index=cargo})