allow nested dictionaries in dict_to_lua

This commit is contained in:
Fabian Dill 2021-06-25 01:55:58 +02:00
parent 91655a855d
commit 20729242f9
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{% macro dict_to_lua(dict) -%}
{
{%- for key, value in dict.items() -%}
["{{ key }}"] = {{ value | safe }}{% if not loop.last %},{% endif %}
["{{ key }}"] = {% if value is mapping %}{{ dict_to_lua(value) }}{% else %}{{ value | safe }}{% endif %}{% if not loop.last %},{% endif %}
{% endfor -%}
}
{%- endmacro %}