Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- diskID.lua
- -- This program displays the ID of the inserted disk in the bottom drive
- local function getDiskID()
- -- Wrap the disk drive at the bottom of the computer
- local drive = peripheral.wrap("bottom")
- if drive and peripheral.getType("bottom") == "drive" then
- -- Check if there is a disk in the drive
- if drive.isDiskPresent() then
- -- Get the disk ID
- local diskID = drive.getDiskID()
- print("Disk ID: " .. diskID)
- return
- else
- print("No disk present in the drive.")
- end
- else
- print("No drive found at the bottom.")
- end
- end
- -- Run the function to get and display the disk ID
- getDiskID()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement