Move Factorio data from /data/factorio to /worlds/factorio/data, to contain it in its world folder
This commit is contained in:
29
worlds/factorio/data/mod_template/macros.lua
Normal file
29
worlds/factorio/data/mod_template/macros.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
{% macro dict_to_lua(dict) -%}
|
||||
{
|
||||
{%- for key, value in dict.items() -%}
|
||||
["{{ key }}"] = {{ variable_to_lua(value) }}{% if not loop.last %},{% endif %}
|
||||
{% endfor -%}
|
||||
}
|
||||
{%- endmacro %}
|
||||
{% macro list_to_lua(list) -%}
|
||||
{
|
||||
{%- for key in list -%}
|
||||
{{ variable_to_lua(key) }}{% if not loop.last %},{% endif %}
|
||||
{% endfor -%}
|
||||
}
|
||||
{%- endmacro %}
|
||||
{%- macro variable_to_lua(value) %}
|
||||
{%- if value is mapping -%}{{ dict_to_lua(value) }}
|
||||
{%- elif value is boolean -%}{{ value | string | lower }}
|
||||
{%- elif value is string -%}"{{ value | safe }}"
|
||||
{%- elif value is iterable -%}{{ list_to_lua(value) }}
|
||||
{%- else -%} {{ value | safe }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
{% macro dict_to_recipe(dict) -%}
|
||||
{
|
||||
{%- for key, value in dict.items() -%}
|
||||
{"{{ key }}", {{ value | safe }}}{% if not loop.last %},{% endif %}
|
||||
{% endfor -%}
|
||||
}
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user