Advertisement
akashi9210

TankReader

Nov 24th, 2024 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | Source Code | 0 0
  1. -- Block Type Reader for Tweaked.cc ComputerCraft
  2. -- This script tests the block directly above the computer.
  3.  
  4. -- Function to get block information above the computer
  5. function getBlockAbove()
  6.     local block = peripheral.wrap("top")
  7.     if block and block.getBlockData then
  8.         return block.getBlockData()
  9.     end
  10.     return nil
  11. end
  12.  
  13. -- Main program
  14. blockInfo = getBlockAbove()
  15.  
  16. if not blockInfo then
  17.     print("No block detected above or unable to retrieve block information.")
  18. else
  19.     print("Block Information:")
  20.     print("  Name: " .. (blockInfo.name or "Unknown"))
  21.     print("  Tags: ")
  22.     for tag, _ in pairs(blockInfo.tags or {}) do
  23.         print("    - " .. tag)
  24.     end
  25. end
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement