mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Add docs for to_json and from_json
This commit is contained in:
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -13,6 +13,8 @@ $built_in_functions = array(
|
||||
'to_color' =>'',
|
||||
'to_image' =>'',
|
||||
'to_date' =>'',
|
||||
'to_json' =>'',
|
||||
'from_json' =>'',
|
||||
'make_map' =>'',
|
||||
// numbers
|
||||
'abs' =>'',
|
||||
|
||||
Reference in New Issue
Block a user