From 70a1cf5c5acb413b099670b630af6995e07286bf Mon Sep 17 00:00:00 2001 From: Wojbie Date: Fri, 15 Jan 2021 20:30:21 +0100 Subject: [PATCH] id.lua now handles more disk types (#677) Co-authored-by: Lupus590 --- .../computercraft/lua/rom/programs/id.lua | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/resources/data/computercraft/lua/rom/programs/id.lua b/src/main/resources/data/computercraft/lua/rom/programs/id.lua index 964503e24..79aecf9e6 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/id.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/id.lua @@ -13,16 +13,30 @@ if sDrive == nil then end else - local bData = disk.hasData(sDrive) - if not bData then + if disk.hasAudio(sDrive) then + local title = disk.getAudioTitle(sDrive) + if title then + print("Has audio track \"" .. title .. "\"") + else + print("Has untitled audio") + end + return + end + + if not disk.hasData(sDrive) then print("No disk in drive " .. sDrive) return end - print("The disk is #" .. disk.getID(sDrive)) + local id = disk.getID(sDrive) + if id then + print("The disk is #" .. id) + else + print("Non-disk data source") + end local label = disk.getLabel(sDrive) if label then - print("The disk is labelled \"" .. label .. "\"") + print("Labelled \"" .. label .. "\"") end end