From 3f372d46748c4259bad519261712054f2c207392 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Thu, 28 Nov 2024 23:11:28 +0100 Subject: [PATCH] Implement debug context args --- storage/itemstack.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/itemstack.lua b/storage/itemstack.lua index 27dcbef..4d65704 100644 --- a/storage/itemstack.lua +++ b/storage/itemstack.lua @@ -7,10 +7,10 @@ local Debugger = require("debugger") local ItemStack = Sentinel:tag({}, Sentinel.ITEMSTACK) ItemStack.__index = ItemStack -local function hookDebugger() +local function hookDebugger(context) local errorCond = Debugger.debugREPL(function(retval) Logger:error("->", retval) - end) + end, context) Logger:error("x>", errorCond) end @@ -202,7 +202,7 @@ end function ItemStack:transferTo(target, count) if target:getMaxCount() == nil then Logger:error("Max count is nil?", target, "\n", self, "\n", count) - hookDebugger() + hookDebugger({ target = target, count = count, self = self }) end local cap = math.min(count or self:getCount(), target:getMaxCount() - target:getCount(), self:getCount()) @@ -233,7 +233,7 @@ function ItemStack:transferTo(target, count) target:getInventory().getItemLimit(target:getSlot()), "\n", result ) - hookDebugger() + hookDebugger({ target = target, count = count, self = self, result = result, errC = errC, cap = cap }) end target:_modify(result[2], self)