Last active
May 15, 2020 03:29
-
-
Save morsk/98a555501beb5eea00f4d09821762a30 to your computer and use it in GitHub Desktop.
Recipe Data Dump [Factorio]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment