Advertisement
Guest User

Untitled

a guest
Apr 15th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. /c
  2.  
  3. --[[ file appears in Factorio's script-output folder ]]
  4. local OUTPUT_FILE = "recipe_dump.txt"
  5.  
  6. local function print_table_to_file(t,filename)
  7. local text_format_of_table = serpent.block(t)
  8. game.write_file(filename, text_format_of_table)
  9. end
  10.  
  11. --[[ https://lua-api.factorio.com/latest/LuaRecipePrototype.html
  12. recipe_prototypes is lazily evaluated, and the table-
  13. dump function can't handle it, so iterate & copy the
  14. parts we want to our own table, first. ]]
  15. local t = {}
  16. for k,v in pairs(game.recipe_prototypes) do
  17. t[k] = {
  18. ingredients = v.ingredients,
  19. products = v.products
  20. }
  21. end
  22.  
  23. print_table_to_file(t, OUTPUT_FILE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement