Update linkedGet.lua

This commit is contained in:
erius0 2021-01-08 04:44:49 +03:00 committed by GitHub
parent d1119176dd
commit df1e8dde13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,8 +4,8 @@ local component = require("component")
local fs = require("filesystem") local fs = require("filesystem")
local tunnel = component.tunnel local tunnel = component.tunnel
local success = "команда выполнена успешно" local success = "console: команда выполнена успешно"
local fail = "неизвестная команда - пиши help" local fail = "console: неизвестная команда - пиши help"
function os.dateRL(format) function os.dateRL(format)
if not fs.get("/").isReadOnly() then if not fs.get("/").isReadOnly() then
@ -41,10 +41,11 @@ end
while true do while true do
local _, _, from, _, _, message = event.pull("modem_message") local _, _, from, _, _, message = event.pull("modem_message")
local log = "["..os.dateRL("%x %X").."]".." "..getUser(tostring(from))..": "..message.."\n"..handleMessage(tostring(message)) local answer = handleMessage(tostring(message)
local log = "["..os.dateRL("%x %X").."] "..getUser(tostring(from))..": "..message.."\n".."["..os.dateRL("%x %X").."] "..answer)
print(log) print(log)
local f = io.open("logs.txt", "a") local f = io.open("logs.txt", "a")
f:write(log.."\n") f:write(log.."\n")
f:close() f:close()
tunnel.send("succes!") tunnel.send(answer)
end end