From 20729242f9abab9be58fe1687be599cab21cbeb5 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 25 Jun 2021 01:55:58 +0200 Subject: [PATCH] allow nested dictionaries in dict_to_lua --- data/factorio/mod_template/macros.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/factorio/mod_template/macros.lua b/data/factorio/mod_template/macros.lua index 47b179ed..fbd309fa 100644 --- a/data/factorio/mod_template/macros.lua +++ b/data/factorio/mod_template/macros.lua @@ -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 %}