LuaScripts/linkedGet.lua

25 lines
690 B
Lua
Raw Normal View History

2021-01-07 23:30:28 +00:00
local event = require("event")
local keyboard = require("keyboard")
local component = require("component")
2021-01-08 00:04:54 +00:00
local fs = require("filesystem")
2021-01-07 23:30:28 +00:00
local tunnel = component.tunnel
2021-01-08 00:04:54 +00:00
local TIME_ZONE = 2
local t_correction = TIME_ZONE * 3600
2021-01-08 00:08:54 +00:00
function os.dateRL(format)
if not fs.get("/").isReadOnly() then
local time = io.open("/tmp/.time", "w")
time:write()
time:close()
os.sleep(0.01)
return os.date(format, fs.lastModified("/tmp/.time") / 1002.7)
else
return os.date(format)
end
2021-01-08 00:04:54 +00:00
end
2021-01-07 23:30:28 +00:00
while true do
local _, _, _, _, _, message = event.pull("modem_message")
2021-01-08 00:08:54 +00:00
local date = os.dateRL("%x %X")
2021-01-08 00:04:54 +00:00
print("[ "..date.." ]"..message)
2021-01-07 23:30:28 +00:00
tunnel.send("succes!")
end