set
Set script variables to the specified values. Variables set using set
can be removed
using unset
.
Parameters
No specific parameters. Accepts an object mapping variable names to values.
Variables
Any variable can be set by this method.
Examples
Setting variables
- YAML
- JSON
version: 1.0.0
sections:
main:
- set:
num_var: 1
- play: "say: %{num_var}"
- set:
num_var: 2
- play: "say: %{num_var}"
{
"version": "1.0.0",
"sections": {
"main": [
{
"set": {
"num_var": 1
}
},
{
"play": "say: %{num_var}"
},
{
"set": {
"num_var": 2
}
},
{
"play": "say: %{num_var}"
}
]
}
}
Setting multiple variables
- YAML
- JSON
version: 1.0.0
sections:
main:
- set:
items:
- drill bit
- drill
person: handyman
systems:
ventilation:
- inlet
- outlet
- fans
hr:
- lucy
- liam
- luke
- play: "say: The items %{items} will be used by %{person} to fix %{systems.ventilation}."
{
"version": "1.0.0",
"sections": {
"main": [
{
"set": {
"items": [
"drill bit",
"drill"
],
"person": "handyman",
"systems": {
"ventilation": [
"inlet",
"outlet",
"fans"
],
"hr": [
"lucy",
"liam",
"luke"
]
}
}
},
{
"play": "say: The items %{items} will be used by %{person} to fix %{systems.ventilation}."
}
]
}
}