aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/functions/get_variable.yaml
blob: f8177c1cf942397a812bd3203a2dddff6a9f9de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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