-
-
Notifications
You must be signed in to change notification settings - Fork 65
Scripting Library: Group. methods
Naim edited this page Jun 13, 2023
·
6 revisions
return type | function | description |
---|---|---|
Group | Group.AddCard(Group g, Card|Group other) | Adds a card or group (Card|Group other) to a group (Group g). Returns the group itself. Equivalent to Group.Merge |
Group | Group.AddMaximumCheck(Group g) | Returns a group containing all the maximum parts of cards that are in maximum mode in the group g, |
bool,void | Group.CheckDifferentProperty(Group g, function f, ...) | Function to check if every card in a group has at least a different property from the others with a function that stores the properties in multiple return forms |
bool | Group.CheckDifferentPropertyBinary(Group g, function f, ...) | Function to check if every card in a group has at least a different property from the others with a function that stores the properties in binary form. |
bool | Group.CheckSameProperty(g, f, ...) | Returns if the members of (Group g) share a same property, provided in (Function f) |
bool, bool | Group.CheckWithSumEqual(Group g, function f, int sum, int min, int max, ...) | Checks if there is a combination of cards, with a minimum and maximum, that has the sum of f(c, ...) result equal to (int sum) in a group (Group g). Function f accepts at least one parameter (f(c, ...). with c as each member of the group), and the return value should be integer. The second returned value indicates whether the check failed because of overtributing (in which case it will be true), or because of undertributing. |
bool, bool | Group.CheckWithSumGreater(Group g, function f, int sum, ...) | Checks if there is a combination of cards, with a minimum and maximum, that has the sum of f(c, ...) result greater than or equal to (int sum) in a group (Group g). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. The second returned value indicates whether the check failed because of overtributing (in which case it will be true), or because of undertributing. |
Group | Group.Clear(Group g) | Removes all the elements from a group (Group g). Returns the group itself. |
Group | Group.Clone(Group g) | Create a copy of a group (Group g) with the same members |
Group | Group.CreateGroup() | Create a new Group object |
void | Group.DeleteGroup(Group g) | Makes a group that was kept alive be collectable (Group g) |
bool | Group.Equal(Group g1, Group g2) | Checks if the first group (Group g1) has the same members with the second group (Group g2) |
Group | Group.Filter(Group g, function f, Group|Card ex|nil, ...) | Create a new group with members from another group (Group g) filtered according to a function (function f). Excludes a card/group (Group/Card ex) if not nil. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the card will be included if f(c, ...) returns true. |
int | Group.FilterCount(Group g, function f, Group|Card ex|nil, ...) | Counts the amount of members of a group (Group g) which meets the function (function f). Excludes a card (Card ex) if not nil. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the card will be included if f(c, ...) returns true. |
Group | Group.FilterSelect(Group g, int player, function f, int min, int max[, bool cancelable=false], Group|Card ex|nil, ...) | Make a player (int player) select members of a group (Group g) which meets the function (function f), with a minimum and a maximum, then outputs the result as a new Group. Excludes a card (Card ex) if not nil. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the card will be included if f(c, ...) returns true. If cancelable is true and the selection is canceled nil will be returned. |
void | Group.ForEach(Group g, function f, ...) | Executes a function for each card in a group (Group g), function f should accept one parameter (e.g. f(c, ...), with c as each member of the group and ... can be any number of parameters) |
Group | Group.FromCards(Card c[, ...]) | Create a new Group object and populate it with cards (Card c, ...) |
Group | Group.FromLuaRef(int ref) | Returns a Group object from a given lua reference. The function errors out if the reference is invalid or does not refer to a Group object. |
int | Group.GetBinClassCount(group g, function f) | |
int | Group.GetBitwiseAnd(Group g, function f, ...) | Gets the "bitwise and" (&) of f(c, ...) result from all members of a group (Group g). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
int | Group.GetBitwiseOr(Group g, function f, ...) | Gets the "bitwise or" (|) of f(c, ...) result from all members of a group (Group g). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
{ int, int, ... } | Group.GetClass(Group g, function f, ...) | Returns a table containing all the different values returned by applying the function f to all the members of the Group g, |
int | Group.GetClassCount(Group g, function f, ...) | Gets the count of different f(c, ...) results from all members of a group (Group g). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
int | Group.GetCount(Group g) | Returns the number of cards in a group (Group g) |
Card/nil | Group.GetFirst(Group g) | Gets the first member of Group g (also resets the internal enumerator). Returns nil if the group is empty. |
int | Group.GetLinkedZone(Group g, int cp) | Returns all the zones that all the cards in g point to (on the field of player "cp"). |
int | Group.GetLuaRef(Group g) | Returns an integer representing the internal value used by lua to access the Group g. |
Group,int/nil | Group.GetMaxGroup(Group g, function f, ...) | Create a new group with members from another group (Group g) which has the maximum result from f(c, ...). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer, if the group g have no element, that function will return nil. |
Group,int/nil | Group.GetMinGroup(Group g, function f, ...) | Create a new group with members from another group (Group g) which has the minimum result from f(c, ...). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer, if the group g have no element, that function will return nil. |
Card/nil | Group.GetNext(Group g) | Gets then next member of Group g (moves the internal enumerator by a step). Returns nil when the whole group was iterated. |
int | Group.GetSum(Group g, function f, ...) | Gets the sum of f(c, ...) result from all members of a group (Group g). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
int | Group.GetToBeLinkedZone(card tc, card c, int tp[, bool clink = false, bool emz = false]) | Returns the zone(s) of a player "tp" such that "c" would point to "tc" if "tc" would be summoned. If "clink" is set to true it will only return the zone(s) so that "c" and "tc" would be co-linked. Set "emz" to true if the summoned monster could be placed in the Extra Monster Zone so that the possibility of Extra Linking is accounted for (see "G Golem Crystal Heart" for an example use). |
bool | Group.Includes(Group g1, Group g2) | Checks if (Group g1) contains all cards in (Group g2) |
bool | Group.IsContains(Group g, Card c) | Checks if a group (Group g) contains a specified card (Card c) |
bool | Group.IsDeleted(Group g) | Returns if the Group object got internally deleted and remained as dangling reference inside the lua state. |
bool | Group.IsExists(Group g, function f, int count, Group|Card ex|nil, ...) | Checks if at least a number (int count) of members of a group (Group g) meet the function (function f). Excludes a card (Card ex) if not nil. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the card will be included if f(c, ...) returns true. |
iterator | Group.Iter(Group g) | Iterates over the cards in (Group g) for use with for loops |
Group | Group.KeepAlive(Group g) | Makes a group (Group g) not be collected upon exiting the function. Returns the group itself. |
Group | Group.Match(Group g, function f, Group|Card ex|nil, ...) | It has the same behaviour as Group.Filter but the changes are done to the Group g and no new group is created. |
Group | Group.Merge(Group g1, Card|Group other) | Add a card or group (Card|Group other) to a group (Group g). Returns the group itself. Equivalent to Group.AddCard |
Group | Group.RandomSelect(Group g, int player, int count) | Make a player (int player) randomly select (int amount) members of a group (Group g). |
Group | Group.Remove(Group g, function f, Group|Card ex|nil, ...) | Removes members of a group (Group g) that meets the function (function f). Excludes a card (Card ex) from removal if not nil. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the card will be included if f(c, ...) returns true. Returns the group g. |
Group | Group.RemoveCard(Group g, Card|Group other) | Removes from (Group g) a card or group (Card|Group other). Returns the group itself. Equivalent to Group.Sub |
Card | Group.SearchCard(Group g, function f, ...) | Gets the first card found in a group (Group g) which f(c, ...) returns true. Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and must return a boolean. |
Group | Group.Select(Group g, int player, int min, int max[, bool cancelable=false] Group|Card ex|nil) | Makes a player (int player) select members of a group (Group g), with a minimum and a maximum, then outputs the result as a new Group. Excludes a card (Card ex) if it is not nil. If (bool cancelable) is true and the selection is canceled nil will be returned. |
Card | Group.SelectUnselect(Group g1, Group g2, int player[, bool finishable, bool cancelable, int min, int max]) | Selects cards in a loop that allows unselection/cancellation. (Group g1) is the group of not selected cards, (Group g2) is the group of already selected cards, (int player) is the player who selects the card, (bool finishable) indicates that the current selection has met the requirements and thus can be finished with the right click, (bool cancelable) indicates that the selection can be canceled with the right click (in the procedures this is set when the selected group is empty and no chain is going on), (int max) and (int min) does nothing to the function, they are only the max and min values shown in the hint. Every card in both the groups can be selected. The function returns a single card |
Group | Group.SelectWithSumEqual(Group g, int player, function f, int sum, int min, int max, ...) | Makes a player (int player) select members of a group (Group g) which results in a combination of cards, with a minimum and maximum, that has the sum of f(c, ...) result equal to (int sum). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
Group | Group.SelectWithSumGreater(Group g, int player, function f, int sum, ...) | Makes a player (int player) select members of a group (Group g) which results in a combination of cards, with a minimum and maximum, that has the sum of f(c, ...) result greater than or equal to (int sum). Function f accepts at least one parameter (f(c, ...), with c as each member of the group), and the return value should be integer. |
Group, Group | Group.Split(Group g, function f, Group|Card ex|nil, ...) | Returns 2 groups, the first group will contain cards matched with the same behaviour as Group.Filter, the second group will contain the remaining cards from the Group g. |
Group | Group.Sub(Group g1, Card|Group other) | Removes from (Group g) a card or group (Card|Group other). Returns the group itself. Equivalent to Group.Remove |
Card/nil | Group.TakeatPos(Group g, int pos) | Returns the card at the index specified (int pos) in the group. Returns nil if the index is greater than the size of the group. |