mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
ad48e2ae16
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@590 0fc631ac-6414-0410-93d0-97cfa31319b6
31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
Function: number_of_items
|
|
|
|
--Usage--
|
|
> number_of_items(in: some_collection)
|
|
|
|
Returns the number of items in a list or the number of characters in a string.
|
|
|
|
Note: This function is exactly the same as [[fun:length]].
|
|
|
|
--Parameters--
|
|
! Parameter Type Description
|
|
| @in@ [[type:list]] or [[type:map]] or [[type:set]] or [[type:string]]
|
|
Object to determine the number of items of.
|
|
When it is a set, returns the number of cards.
|
|
When it is a string, returns the number of characters.
|
|
| @filter@ [[type:function]] (optional) Act as if the list was [[fun:filter_list|filtered]] by this criterion.
|
|
Only when @in@ is a set.
|
|
|
|
--Examples--
|
|
> number_of_items(in: ["x", "y", "z"]) == 3
|
|
> number_of_items(in: "pink") == 4
|
|
> number_of_items(in: set) == # number of cards in the set
|
|
>
|
|
> # the number of red cards in the set
|
|
> number_of_items(in: set, filter: { card.color == "red" } )
|
|
|
|
--See also--
|
|
| [[fun:length]] Return the number of items in a list.
|
|
| [[fun:sort_list]] Sort a list.
|
|
| [[fun:filter_list]] Filter a list, keeping only elements that match a predicate.
|