cleanup
This commit is contained in:
parent
c78597a8fb
commit
760729ee4b
14 changed files with 126 additions and 102 deletions
|
@ -1,4 +1,4 @@
|
|||
pp = require("cc.pretty")
|
||||
pp = require("cc.pretty").pretty_print
|
||||
require("stringshit")
|
||||
recipes = {}
|
||||
|
||||
|
@ -51,18 +51,17 @@ function read_recipe(file)
|
|||
end
|
||||
|
||||
function load_recipes()
|
||||
file = fs.open("recipes.txt", "r")
|
||||
local file = fs.open("recipes.txt", "r")
|
||||
if not file then
|
||||
print("error: no recipes found")
|
||||
return
|
||||
end
|
||||
recipes = {}
|
||||
while 1 do
|
||||
r = read_recipe(file)
|
||||
local r = read_recipe(file)
|
||||
if r == nil then break end
|
||||
recipes[r.product] = r
|
||||
end
|
||||
return recipes
|
||||
end
|
||||
|
||||
function ingredientsOf(recipe)
|
||||
|
@ -80,4 +79,6 @@ function ingredientsOf(recipe)
|
|||
items[recipe.base] = (items[recipe.base] or 0) + 1
|
||||
end
|
||||
return items
|
||||
end
|
||||
end
|
||||
|
||||
load_recipes()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue