updated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
local diskDrive = peripheral.find("drive")
|
||||
local monitor = require("monitor-driver")
|
||||
|
||||
local function getFilePath()
|
||||
if diskDrive and diskDrive.isDiskPresent() then
|
||||
local path = diskDrive.getMountPath()
|
||||
@@ -75,9 +75,10 @@ local function writeValue(key, value)
|
||||
end
|
||||
|
||||
local function initialize()
|
||||
monitor.writeLine("Initializing Data Storage...")
|
||||
local monitor = peripheral.find("monitor")
|
||||
if monitor then monitor.write("Initializing Data Storage...") end
|
||||
if diskDrive and diskDrive.isDiskPresent() then
|
||||
monitor.writeLine("Disk detected. Initializing data storage.")
|
||||
if monitor then monitor.write("Disk detected. Initializing data storage.") end
|
||||
local path = getFilePath()
|
||||
if path and not fs.exists(path) then
|
||||
saveData({})
|
||||
|
||||
Reference in New Issue
Block a user