Advertisement
TechManDylan

TurtleInspect

May 22nd, 2025
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. -- Inspect the block in front of the turtle
  2. local success, data = turtle.inspect()
  3.  
  4. if success then
  5.     local blockName = data.name or "unknown_block"
  6.     local fileName = blockName .. ".txt"
  7.  
  8.     local file = fs.open(fileName, "w")
  9.     if file then
  10.         file.write(textutils.serialize(data))
  11.         file.close()
  12.         print("Block data written to " .. fileName)
  13.     else
  14.         print("Failed to open file for writing.")
  15.     end
  16. else
  17.     print("No block in front to inspect.")
  18. end
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement