Group.Select
Signature
lua
Group.Select(Group g, int player, int min, int max, [Card|Group|nil ex]) -> Group|nilDescription
Lets player choose min to max cards from g, optionally excluding ex, and returns the selected Group. This is a plain Group choice; it does not register Chain targets or create IsRelateToEffect relations.
How To Use It
Use this when you already built the candidate Group and only need the player to choose from it.
lua
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)If you still need to filter while selecting, use Group.FilterSelect or Duel.SelectMatchingCard instead.
Related Functions
Parameters
gGroup- Selectable card pool.playerint- Player who makes the selection; invalid players make the core return no values.minint- Minimum number of cards to select.maxint- Maximum number of cards to select.exCard|Group|niloptional - Card or Group excluded from selectable cards; nil excludes nothing.
Returns
Group|nil- New Group containing selected cards, or nil if player is invalid.
Source
D:\Programs\GitHub\ygopro-core\libgroup.cpp:915
Guided Examples
Learn how to use this function in context:
- Filters, Card Objects, and Group Objects
- First Scripts To Study
- Fusion Summon Choices
- Min/Max Stat Card Selection
- Selection And Group Handling
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 1417 indexed script(s).
- Search this function in the Script Explorer with
Group.Select.
Script Examples
Salamandra with Chain (62091148)
Source: Scripts/c62091148.lua
lua
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) thenAstrograph Sorcerer, the Starfrost Magician (48171151)
Source: Scripts/c48171151.lua
lua
if #desg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=desg:Select(tp,1,1,nil)
local tc=sg:GetFirst()
if tc thenArtmage Non-Finito (74631897)
Source: Scripts/c74631897.lua
lua
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or ce and not Duel.SelectYesNo(tp,ce:GetDescription())) then