34 lines
919 B
Lua
34 lines
919 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()
|
|
setNewLine()
|
|
setNewLine()
|
|
monitor.setBackgroundColor(colors.blue)
|
|
monitor.write("Radiation Levels:")
|
|
monitor.setBackgroundColor(colors.black)
|
|
local internal = getValue(internalEnvironment)
|
|
local external = getValue(externalEnvironment)
|
|
setNewLine()
|
|
monitor.write("Internal: " .. internal)
|
|
setNewLine()
|
|
monitor.write("External: " .. external)
|
|
end
|
|
return { report = report, watch = watch, startup = startup, shutdown = shutdown } |