View difference between Paste ID: UxhKgfW8 and d4ugSj2p
SHOW: | | - or go back to the newest paste.
1-
-- enchantTurtle.lua
1+
local chest = peripheral.wrap("right")
2
local item = chest.getItemDetail(1)
3-
-- Wrap the input chest in front
3+
if not item then
4-
local frontChest = peripheral.wrap("front")
4+
  print("No item")
5-
if not frontChest then
5+
  return
6-
  error("❌ No chest detected in front of the turtle")
6+
7
8
print("Fields in item slot 1:")
9-
-- Helper to test if the chest is empty
9+
for key in pairs(item) do
10-
local function isChestEmpty(chest)
10+
  print("– "..key)
11-
  -- chest.list() returns a sparse table of slots → items
11+
end