diff --git a/doc/function/from_json.txt b/doc/function/from_json.txt new file mode 100644 index 00000000..d51968e6 --- /dev/null +++ b/doc/function/from_json.txt @@ -0,0 +1,19 @@ +Function: from_json + +--Usage-- +> from_json(some_JSON_string) + +Convert a JSON string to a [[type:list]], a [[type:map]], a [[type:card]], a [[type:keyword]], a [[type:pack_type]] or a [[type:set]]. + +To see the required syntax, use an output of the [[fun:to_json]] function. + +--Parameters-- +! Parameter Type Description +| @input@ [[type:string]] JSON string to convert to an MSE script value. +| @set@ [[type:set]] The active set. This can be omited since "set" is a predefined variable. + +--Examples-- +> add_card_to_set(from_json("\{\"mse_object_type\":\"card\", \"data\":\{\"name\":\"Ajani\", \"rarity\":\"mythic rare\"\}\}")) + +--See also-- +| [[fun:to_json]] Convert an MSE script value to JSON text. diff --git a/doc/function/get_card_stylesheet.txt b/doc/function/get_card_stylesheet.txt index d1d74502..7a3610a0 100644 --- a/doc/function/get_card_stylesheet.txt +++ b/doc/function/get_card_stylesheet.txt @@ -10,7 +10,7 @@ This is for use in exporter scripts. In card scripts, use the "stylesheet" prede --Parameters-- ! Parameter Type Description | @input@ [[type:card]] The card you want to retrieve the stylesheet from. -| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be ommited since "set" is a predefined variable. +| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be omited since "set" is a predefined variable. --Examples-- > # Retrieve the card regions from the card's stylesheet diff --git a/doc/function/get_card_styling.txt b/doc/function/get_card_styling.txt index f7f6e15e..34a1c17a 100644 --- a/doc/function/get_card_styling.txt +++ b/doc/function/get_card_styling.txt @@ -10,7 +10,7 @@ This is for use in exporter scripts. In card scripts, use the "styling" predefin --Parameters-- ! Parameter Type Description | @input@ [[type:card]] The card you want to retrieve the styling data from. -| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be ommited since "set" is a predefined variable. +| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be omited since "set" is a predefined variable. --Examples-- > # Retrieve the value "is foil" from the card's styling options diff --git a/doc/function/index.txt b/doc/function/index.txt index 88316bbd..731336a8 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -11,6 +11,8 @@ These functions are built into the program, other [[type:function]]s can be defi | [[fun:to_color]] Convert any value to a [[type:color]] | [[fun:to_image]] Convert any value to an [[type:image]] | [[fun:to_date]] Convert any value to a [[type:date]] +| [[fun:to_json]] Convert any value to JSON text. +| [[fun:from_json]] Convert JSON text to an MSE script value. | [[fun:make_map]] Create a [[type:map]] from two [[type:list]]s | [[fun:type_name]] Get the type of a value diff --git a/doc/function/to_json.txt b/doc/function/to_json.txt new file mode 100644 index 00000000..3e160b91 --- /dev/null +++ b/doc/function/to_json.txt @@ -0,0 +1,18 @@ +Function: to_json + +--Usage-- +> to_json(some_script_value) + +Convert a [[type:list]], a [[type:map]], a [[type:card]], a [[type:keyword]], a [[type:pack_type]] or a [[type:set]] to a JSON string. + + +--Parameters-- +! Parameter Type Description +| @input@ some_script_value MSE script value to convert to a JSON string. +| @set@ [[type:set]] The active set. This can be omited since "set" is a predefined variable. + +--Examples-- +> to_json(card) + +--See also-- +| [[fun:from_json]] Convert JSON text to an MSE script value. diff --git a/tools/website/drupal/mse-drupal-modules/highlight.inc b/tools/website/drupal/mse-drupal-modules/highlight.inc index 2fbb536c..92b8b367 100644 --- a/tools/website/drupal/mse-drupal-modules/highlight.inc +++ b/tools/website/drupal/mse-drupal-modules/highlight.inc @@ -13,6 +13,8 @@ $built_in_functions = array( 'to_color' =>'', 'to_image' =>'', 'to_date' =>'', + 'to_json' =>'', + 'from_json' =>'', 'make_map' =>'', // numbers 'abs' =>'',