I decided to make it very easy to store information based on the slots in the inventory most often used for crafting: 1 - 3, 5 - 7, 9 - 11. From this idea, I began trying to fit the information in a smaller and smaller space, but quickly realized I couldn't shorten things easily due to the large amount of different items in the game. I decided to include the shortened terms in the format, on the first line. I also wished to make my format human-readable. It is quite annoying to debug something you cannot understand.

Now, from all this tweaking with strings and whatnot, I created my parse function (Big thanks to Lyqyd for helping me out in Ask a Pro).

After this I went on to create a way to easily convert a table to the format. I was thinking about using the raw data from turtle.getItemDetail, but decided against it, figuring users can easily do this themselves. (If it's requested I can change it). Instead, you will need to supply my api with the names (there is currently no support for metadata, although again if it's requested I may change it)

Now, of options I discussed above, only one is directly accessible from the api. This is the makeCraft function.

makeCraft usageThis function converts a table into a formatted craft. It uses a table that can be easily gained by the below. (note: it will simply ignore indexes 4, 8, 12-16. You can have them or you can discard them)

os.loadAPI( "api" )
local tbl = {}
for i = 1, 11 do
  local detail = turtle.getItemDetail()
  tbl[ i ] = detail and detail.name or nil
end
local craft_format = api.makeCraft( tbl )

Among the other functions available are loadCrafts and saveCrafts. These two function deal with files, reading and writing respectively.

loadCraftsSimply give this function a file name, and it will return all the crafts you have stored there.

os.loadAPI( "api" )
local crafts = api.loadCrafts( "Machines.crft" ) --#note: you don't need the file extension.
Now, to go with this I should add the metatmethods revealed when you use this!

--#continuing..
local am = crafts[ "pulv" ]:getAmounts() --#this returns a table of the amounts
print( "To craft a pulv, you will need" )
for item, amount in pairs( am ) do
  print( amount .. " " .. item )
end
--#additionally, to get the amount of a particular item
local requiredRedstone = crafts[ pulv ]:getAmount( "redstone" )

saveCraftsThis function assumes you have not used the makeCraft function on your table, and they are in the specified format for that function.
Essentially, this function expects a table formatted quite like this*:


local tbl = {
  craft_name = {
     [1] = craft_item,
     [2] = craft_item,
     [3] = craft_item,
     [5] = craft_item,
     --#etc.
  },
  another_craft = {
     --#bla bla bla
  },
}
*this would not actually work. It's just a representation of the structure.

Now, some people may want to create their own crafts, without the use of my function. Here's a small example*:

furnace={m@minecraft;s@cobblestone;n@none
m:s&m:s&m:s&
m:s&n:n&m:s&
m:s&m:s&m:s&}
*This is included in the api, as a comment

Now that you've (hopefully) got some idea of how this works, and have read the documentation thoroughly I can reveal the pastebin link!

Spoilerpastebin get JEvaHDH9