Skip to content

Commit 76f8d01

Browse files
committed
Add documentation about variable substitutions
1 parent af08325 commit 76f8d01

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/architecture/script_reader.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ The data dictionary supports the following types
8080
Script code side
8181
~~~~~~~~~~~~~~~~
8282

83+
Variable replacements
84+
^^^^^^^^^^^^^^^^^^^^^
85+
86+
Variable replacements in the script code are done using the syntax ``{{ variable_name }}``. For
87+
this to work, the variable ``variable_name`` has to be defined in the data dictionary passed to the
88+
``ScriptReader``.
89+
90+
The expression ``{{ variable_name }}`` will be replaced with the string representation of the
91+
variable's content.
92+
93+
- If the variable is a string, it has to be wrapped into quotes in the script
94+
code. e.g.
95+
96+
.. code-block:: python
97+
98+
textmsg("{{ log_message }}")
99+
100+
101+
- Boolean variables will be replaced with the string ``True`` or ``False``.
102+
- Numeric variables (integer and floating point) will be replaced with the string representation generated by
103+
`std::to_string() <https://en.cppreference.com/w/cpp/string/basic_string/to_string>`_.
104+
- Version information variables will be replaced with the string representation similar to
105+
``10.7.0.0``
106+
83107
Boolean expressions
84108
^^^^^^^^^^^^^^^^^^^
85109

0 commit comments

Comments
 (0)