Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /c
- --[[ file appears in Factorio's script-output folder ]]
- local OUTPUT_FILE = "recipe_dump.txt"
- local function print_table_to_file(t,filename)
- local text_format_of_table = serpent.block(t)
- game.write_file(filename, text_format_of_table)
- end
- --[[ https://lua-api.factorio.com/latest/LuaRecipePrototype.html
- recipe_prototypes is lazily evaluated, and the table-
- dump function can't handle it, so iterate & copy the
- parts we want to our own table, first. ]]
- local t = {}
- for k,v in pairs(game.recipe_prototypes) do
- t[k] = {
- ingredients = v.ingredients,
- products = v.products
- }
- end
- print_table_to_file(t, OUTPUT_FILE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement