diff --git a/consumer/main.lua b/consumer/main.lua index b597cbe..f8e9503 100644 --- a/consumer/main.lua +++ b/consumer/main.lua @@ -8,8 +8,7 @@ local function run() monitor.writeLine("Starting system...") monitor.writeLine("System started successfully!") - data.writeValue("computer-name", "Papercut87") - computerName = data.getValue("computer-name") + computerName = data.getRead("computer-name") monitor.writeLine("Computer name: " .. computerName) end diff --git a/disk-driver.lua b/disk-driver.lua index 18aa398..df763c2 100644 --- a/disk-driver.lua +++ b/disk-driver.lua @@ -87,4 +87,15 @@ local function initialize() return false end -return { getValue = getValue, updateValue = updateValue, writeValue = writeValue, initialize = initialize } \ No newline at end of file +local function getRead(key) + local value = getValue(key) + if value then + return value + end + print("Enter value for " .. key .. ":") + local input = read() + writeValue(key, input) + return input +end + +return { getValue = getValue, updateValue = updateValue, writeValue = writeValue, initialize = initialize, getRead = getRead } \ No newline at end of file