Skip to content

Group.Filter ​

Signature ​

lua
Group.Filter(Group g, function f, [Card|Group|nil ex], ... any) -> Group

Description ​

Returns a new Group containing cards from g that satisfy filter f and are not excluded by ex. Extra arguments after ex are passed to f after the card argument. The source Group is not modified.

How To Use It ​

Use this when you already have a Group and want a smaller Group from it.

lua
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
local fg=g:Filter(Card.IsFaceup,nil)

Extra arguments after ex are passed to the filter after the card. The original Group is not destroyed; the function returns a new Group.

Parameters ​

  • g Group - Group to filter; it is not modified.
  • f function - Filter callback called for each candidate card.
  • ex Card|Group|nil optional - Card or Group excluded before filtering; nil excludes nothing.
  • ... any - Extra values forwarded to f after the candidate Card.

Returns ​

  • Group - New Group containing cards that passed f.

Source ​

  • D:\Programs\GitHub\ygopro-core\libgroup.cpp:912

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 839 indexed script(s).
  • Search this function in the Script Explorer with Group.Filter.
CardIDScriptDetected Calls
Salamandra with Chain62091148Scripts/c62091148.lua3
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua6
Artmage Non-Finito74631897Scripts/c74631897.lua6
Pendulum Evolution55795155Scripts/c55795155.lua2
Levia-Dragoon - Daedalus78579058Scripts/c78579058.lua4
Lady's Dragonmaid48658295Scripts/c48658295.lua5
Azure Ocean Dragon Lord - Neo-Daedalus Rage41570943Scripts/c41570943.lua4
Goyo Emperor59255742Scripts/c59255742.lua3
Ashtraja Susanoo17020474Scripts/c17020474.lua5
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua1
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua4
Fiendsmith's Sequence49867899Scripts/c49867899.lua2
D/D/D Alfred the Divine Sage King11852093Scripts/c11852093.lua4
El Shaddoll Apkallone50907446Scripts/c50907446.lua2
Mementotlan Fusion66518509Scripts/c66518509.lua4
Meteoroa Drytron24166324Scripts/c24166324.lua7
Performage Cup Tricker6812770Scripts/c6812770.lua1
Lubellion the Searing Dragon70534340Scripts/c70534340.lua2
Pere-Zenet Em Heru46273941Scripts/c46273941.lua2
Am Duazenet45151304Scripts/c45151304.lua2
Magnet Bonding65514302Scripts/c65514302.lua2
Prank-Kids Weather Washer44509529Scripts/c44509529.lua2
PSY-Framelord Omega74586817Scripts/c74586817.lua2
Graydle Split75361204Scripts/c75361204.lua1
...and 815 more

Script Examples ​

Salamandra with Chain (62091148) ​

Source: Scripts/c62091148.lua

lua
function s.spop(e,tp,eg,ep,ev,re,r,rp)
	local chkf=tp
	local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter1,nil,e)
	local mg2=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_GRAVE,0,nil,e)
	mg1:Merge(mg2)

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
			and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
	end
	local desg=eg:Filter(s.desfilter,nil,tp)
	Duel.SetTargetCard(desg)
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
function s.getrg(tp,sc)
	local rg=Duel.GetReleaseGroup(tp,true,REASON_SPSUMMON)
	local mrg=rg:Filter(Card.IsHasEffect,nil,EFFECT_EXTRA_RELEASE)
	if mrg:GetCount()>0 then
		return mrg:Filter(s.spfilter,nil,tp,sc)