Compare commits

..

No commits in common. "0ff986a4f229a52e34a4cab163dc09d5ee2c67d2" and "226190b1f2ce0779fa7484f622cc42a48379fea1" have entirely different histories.

2 changed files with 6 additions and 45 deletions

View File

@ -1,27 +0,0 @@
local function execDebug()
local input = io.input()
local result = { pcall(input.read, input, "*l") }
if not result[1] then
return false, result[2]
end
local func = load("return " .. result[2])
if type(func) ~= "function" then
return false, func
end
return pcall(func)
end
local function debugREPL(onResult)
local result, retval
repeat
result, retval = execDebug()
if result and type(onResult) == "function" then
onResult(retval)
end
until not result
return retval
end
return { debugREPL = debugREPL, execDebug = execDebug }

View File

@ -2,7 +2,6 @@ local Inventory = require("storage.inventory")
local Sentinel = require("storage.sentinel") local Sentinel = require("storage.sentinel")
local Logging = require("logging") local Logging = require("logging")
local Logger = Logging.getGlobalLogger() local Logger = Logging.getGlobalLogger()
local Debugger = require("debugger")
local ItemStack = Sentinel:tag({}, Sentinel.ITEMSTACK) local ItemStack = Sentinel:tag({}, Sentinel.ITEMSTACK)
ItemStack.__index = ItemStack ItemStack.__index = ItemStack
@ -200,12 +199,7 @@ function ItemStack:transferTo(target, count)
return count == 0, 0 return count == 0, 0
end end
local errC = 0 local result = { pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot()) }
local result
repeat
result = { pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot()) }
errC = errC + 1
until (not result[1]) or (result[2] ~= nil) or (errC > 8)
if not result[1] then if not result[1] then
return false, result[2] return false, result[2]
@ -213,19 +207,13 @@ function ItemStack:transferTo(target, count)
if result[2] == nil then if result[2] == nil then
Logger:error( Logger:error(
"Error transferring item", self:getInventory().pushItems, "\n", "Error transferring item", self:getInventory().pushItems, Logger.plain("\n"),
peripheral.getName(target:getInventory()), "\n", peripheral.getName(target:getInventory()), Logger.plain("\n"),
errC, "\n", cap, Logger.plain("\n"),
cap, "\n", self, Logger.plain("\n"),
self, "\n", target, Logger.plain("\n"),
target, "\n",
target:getInventory().getItemLimit(target:getSlot()), "\n",
result result
) )
local errorCond = Debugger.debugREPL(function(retval)
Logger:error("->", retval)
end)
Logger:error("x>", errorCond)
end end
target:_modify(result[2], self) target:_modify(result[2], self)