How to read a table from file

Started by redstonegenius, Sep 28, 2021, 07:25 pm

Previous topic - Next topic


So I am trying to make a api that basically does craftingAPI.craftFromName(<itemName>, <amount>) and have it automatically find the recipe from a dictionary and craft the item. I already got it so It can craft if given the recipe in the form of a 3x3 array, but I am having trouble with the dictionary part.

Basically I want two type of dictionaries, recipe and material type. Material types are items that can be replaced without altering what get outputted, like the types of planks used for a chest. and I want the recipies in the dicitonaries to look something like this


The thing is, I don't have a clue how to turn the table that is being inputed as a string by the function into a actual table that I can have the craftingAPI use.

How can I convert these strings into a proper table