| 
									
										
										
										
											2021-05-22 10:06:21 +02:00
										 |  |  | {% macro dict_to_lua(dict) -%} | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | {%- for key, value in dict.items() -%} | 
					
						
							| 
									
										
										
										
											2021-07-02 01:29:49 +02:00
										 |  |  |     ["{{ key }}"] = {{ variable_to_lua(value) }}{% if not loop.last %},{% endif %} | 
					
						
							| 
									
										
										
										
											2021-05-22 10:06:21 +02:00
										 |  |  | {% endfor -%} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-10-28 21:00:06 +02:00
										 |  |  | {% endmacro %} | 
					
						
							| 
									
										
										
										
											2021-07-04 22:21:53 +02:00
										 |  |  | {% macro list_to_lua(list) -%} | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | {%- for key in list -%} | 
					
						
							|  |  |  |     {{ variable_to_lua(key) }}{% if not loop.last %},{% endif %} | 
					
						
							|  |  |  | {% endfor -%} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | {%- endmacro %} | 
					
						
							| 
									
										
										
										
											2021-07-02 01:29:49 +02:00
										 |  |  | {%- macro variable_to_lua(value) %} | 
					
						
							|  |  |  | {%- if value is mapping -%}{{ dict_to_lua(value) }} | 
					
						
							|  |  |  | {%- elif value is boolean -%}{{ value | string | lower }} | 
					
						
							| 
									
										
										
										
											2021-07-04 22:21:53 +02:00
										 |  |  | {%- elif value is string -%}"{{ value | safe }}" | 
					
						
							|  |  |  | {%- elif value is iterable -%}{{ list_to_lua(value) }} | 
					
						
							| 
									
										
										
										
											2021-07-02 01:29:49 +02:00
										 |  |  | {%- else -%} {{ value | safe }} | 
					
						
							|  |  |  | {%- endif -%} | 
					
						
							|  |  |  | {%- endmacro -%} | 
					
						
							| 
									
										
										
										
											2021-11-25 09:44:01 -08:00
										 |  |  | {% macro dict_to_recipe(dict, liquids) -%} | 
					
						
							| 
									
										
										
										
											2021-05-22 10:06:21 +02:00
										 |  |  | { | 
					
						
							|  |  |  | {%- for key, value in dict.items() -%} | 
					
						
							| 
									
										
										
										
											2021-11-25 09:44:01 -08:00
										 |  |  |     {type = {% if key in liquids %}"fluid"{% else %}"item"{% endif %}, name = "{{ key }}", amount = {{ value | safe }}}{% if not loop.last %},{% endif %} | 
					
						
							| 
									
										
										
										
											2021-05-22 10:06:21 +02:00
										 |  |  | {% endfor -%} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-11-11 11:43:16 +01:00
										 |  |  | {%- endmacro %} |