Files
MagicSetEditor2/doc/function/new_card.txt
T
GenevensiS e45353af9b Add Json importer (#46)
add boost-json to dependencies
2025-06-21 07:53:35 +02:00

27 lines
947 B
Plaintext

Function: new_card
--Usage--
> new_card(map_of_field_names_to_values)
Create a new [[type:card]] object not already in the set.
The argument is a map of values to set, for example @new_card([name: "My Card"])@ creates a card with the name @"My Card"@, and all other fields at their default value.
NOTE: you should use underscores instead of spaces in field names.
--Parameters--
! Parameter Type Description
| @input@ [[type:map]] of field names to field values Field values to set
| @ignore_field_not_found@ [[type:boolean]] Optional. If set to true, key/value pairs that don't correspond to a card field will be ignored instead of throwing.
--Examples--
> # Create a new card
> my_card := new_card(
> [ name: "My Card"
>> , type: "Super cool"
>> , rule_text: "This card is <i>mine</i>!"
> ])
>
> # Write an image of the card to a file
> write_image_file(my_card, file: "my_card.jpg")