Fixed buggy debug messages
authorOlav Bakke Svendsen <mail@olavbs.no>
Mon, 30 Oct 2023 16:10:09 +0000 (17:10 +0100)
committerOlav Bakke Svendsen <mail@olavbs.no>
Mon, 30 Oct 2023 16:11:56 +0000 (17:11 +0100)
cobble-loader.lua

index fa6620a77acd0dd340ddb6af8bff531f3f22ed67..3170544a0228bec2b80303b68e85a1f239bbe1a0 100644 (file)
@@ -51,7 +51,7 @@ local output_amounts = function()
       item and item.name == "minecraft:cobblestone"
       and item.count or 0
     local free_space = p.getItemLimit(2) - count
-    debug("Output "..shorten(output).." needs "..free_space.." cobble")
+    debug("Output "..shorten(output).." needs "..tostring(free_space).." cobble")
     if free_space > 0 then 
       table.insert(t, { address = output, free_space = free_space })
     end
@@ -71,7 +71,7 @@ local input_amounts = function()
     local count =
       item and item.name == "minecraft:cobblestone"
       and item.count or 0
-    debug("Input "..shorten(input).." has"..count.." cobble")
+    debug("Input "..shorten(input).." has "..tostring(count).." cobble")
     table.insert(t, { address = input, count = count })
   end
   table.sort(t, function(a, b) return a.count > b.count end)
@@ -89,15 +89,15 @@ local move_cobble = function()
     to_move_total = to_move_total + output.free_space
     for _, input in ipairs(input_amounts()) do
       if to_move <= 0 then
-        debug("Output "..shorten(output).." full")
+        debug("Output "..shorten(output.address).." full")
         break
       end
       local moved = p.pullItems(input.address, 1, math.min(input.count, to_move), 2)
       -- moved may not be integer if pullItems failed.. look out
       to_move = to_move - moved
       to_move_total = to_move_total - moved
-      debug("Moved "..tostring(moved).." cobble from input "..shorten(input).." to output "..shorten(output))
-      if to_move > 0 then debug("Output "..shorten(output).." still needs "..tostring(to_move).." cobble") end
+      debug("Moved "..tostring(moved).." cobble from input "..shorten(input.address).." to output "..shorten(output.address))
+      if to_move > 0 then debug("Output "..shorten(output.address).." still needs "..tostring(to_move).." cobble") end
     end
   end
   debug("Done moving cobble")