Data Exporter to JSON


Outputs|Exports a JSON file to /script-output/recipe-lister that lists all recipes, crafting machines, mining drills, belts, inserters, resources, items, fluids, and technologies loaded on player creation. Settings for split files and toggles for each category

Utilities
3 years ago
0.16 - 1.1
777

b Empty Array exported as empty object

2 years ago

Krastario has recipes with no ingredients. The ingredients property of those recipes have an empty object instead of an empty array

2 years ago

This stems from the fact that there is little distinction in Lua between an object and an array, since they're all tables. The only easy way to tell them apart is to try getting the index 1 and seeing whether the table has an entry there. Since empty tables don't have any entries, they are printed as objects by the json function. You can try nullchecking the entries to prevent type errors in the meantime.

New response