diff --git a/compacting-storage.lua b/compacting-storage.lua index 2e51a16..363b665 100644 --- a/compacting-storage.lua +++ b/compacting-storage.lua @@ -79,19 +79,19 @@ function craft_multiple (item_type, conversion_type, count) end function execute_crafts (item_type, crafts) - local form = "nuggets" - if crafts[form] > 0 then + local num_crafts = crafts.nuggets + if num_crafts > 0 then print(("Crafting %s nuggets"):format(item_type)) craft_multiple(item_type, 4, num_crafts) - elseif crafts[form] < 0 then + elseif num_crafts < 0 then print(("Crafting %s ingots"):format(item_type)) craft_multiple(item_type, 1, -num_crafts) end - form = "blocks" - if crafts[form] > 0 then + num_crafts = crafts.blocks + if num_crafts > 0 then print(("Crafting %s blocks"):format(item_type)) craft_multiple(item_type, 2, num_crafts) - elseif crafts[form] < 0 then + elseif num_crafts < 0 then print(("Crafting %s ingots"):format(item_type)) craft_multiple(item_type, 3, -num_crafts) end