Group.Filter
Signature
lua
Group.Filter(Group g, function f, [Card|Group|nil ex], ... any) -> GroupDescription
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.
Related Functions
Parameters
gGroup- Group to filter; it is not modified.ffunction- Filter callback called for each candidate card.exCard|Group|niloptional - 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.
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)