30 lines
772 B
Lua
30 lines
772 B
Lua
|
|
local function getValue(env)
|
|
local value = env.getRadiation()
|
|
print(value.radiation, value.unit)
|
|
local stringValue = toString(value.radiation) .. toString(value.unit)
|
|
return stringValue
|
|
end
|
|
|
|
local function watch()
|
|
while true do
|
|
sleep(0.05) -- Update every tenth second
|
|
end
|
|
end
|
|
|
|
local function startUp()
|
|
end
|
|
|
|
local function shutdown()
|
|
end
|
|
|
|
local function report()
|
|
local color = colors.black
|
|
monitor.setBackgroundColor(color)
|
|
|
|
setNewLine()
|
|
monitor.write("Internal Radiation Level: " .. getValue(internalEnvironment))
|
|
setNewLine()
|
|
monitor.write("External Radiation Level: " .. getValue(externalEnvironment))
|
|
end
|
|
return { report = report, watch = watch, startUp = startUp, shutdown = shutdown } |