aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/functions/get_variable.yaml
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-08-21 16:27:56 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-10-03 11:46:34 +0200
commit2b482e39a90fa1929e0fa4006861f4264f28adb2 (patch)
tree0af5ef229d25bef1b974445406fc3c9d28c0756f /docs/yaml/functions/get_variable.yaml
parentad65a699f93a7659739287882ca27c58c564670b (diff)
downloadmeson-2b482e39a90fa1929e0fa4006861f4264f28adb2.zip
meson-2b482e39a90fa1929e0fa4006861f4264f28adb2.tar.gz
meson-2b482e39a90fa1929e0fa4006861f4264f28adb2.tar.bz2
docs: Add the YAML Reference manual
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 0000000..f8177c1
--- /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