summaryrefslogtreecommitdiff
path: root/docs/yaml/functions/get_variable.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'docs/yaml/functions/get_variable.yaml')
-rw-r--r--docs/yaml/functions/get_variable.yaml19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/yaml/functions/get_variable.yaml b/docs/yaml/functions/get_variable.yaml
new file mode 100644
index 000000000..f8177c1cf
--- /dev/null
+++ b/docs/yaml/functions/get_variable.yaml
@@ -0,0 +1,19 @@
+name: get_variable
+returns: any
+description: |
+ This function can be used to dynamically obtain a variable. `res =
+ get_variable(varname, fallback)` takes the value of `varname` (which
+ must be a string) and stores the variable of that name into `res`. If
+ the variable does not exist, the variable `fallback` is stored to
+ `res`instead. If a fallback is not specified, then attempting to read
+ a non-existing variable will cause a fatal error.
+
+posargs:
+ variable_name:
+ type: str
+ description: Name of the variable to get
+
+optargs:
+ default:
+ type: any
+ description: Fallback value to return when the variable does not exist