Advertisement
DOGGYWOOF

Untitled

Jun 17th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. -- diskID.lua
  2. -- This program displays the ID of the inserted disk in the bottom drive
  3.  
  4. local function getDiskID()
  5. -- Wrap the disk drive at the bottom of the computer
  6. local drive = peripheral.wrap("bottom")
  7.  
  8. if drive and peripheral.getType("bottom") == "drive" then
  9. -- Check if there is a disk in the drive
  10. if drive.isDiskPresent() then
  11. -- Get the disk ID
  12. local diskID = drive.getDiskID()
  13. print("Disk ID: " .. diskID)
  14. return
  15. else
  16. print("No disk present in the drive.")
  17. end
  18. else
  19. print("No drive found at the bottom.")
  20. end
  21. end
  22.  
  23. -- Run the function to get and display the disk ID
  24. getDiskID()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement