get_variable()

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 resinstead. If a fallback is not specified, then attempting to read a non-existing variable will cause a fatal error.

Signature

# This function can be used to dynamically obtain a variable
any get_variable(
  str variable_name,     # Name of the variable to get
  any [default],         # Fallback value to return when the variable does not exist
)

Arguments

Argument flattening is NOT SUPPORTED by this function.

The function get_variable() accepts the following positional arguments:

Name Type Description Tags
variable_name str

Name of the variable to get

default any

Fallback value to return when the variable does not exist

[optional]

The results of the search are