Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ===============================
- -- remoteLogReceiver.lua
- -- ===============================
- -- -------------------------------
- -- config
- -- -------------------------------
- local MODEM_DIR = "top"
- local FILE_ENABLED = true
- local FILE_NAME = "remote.log"
- local PRINT_ENABLED = true
- -- -------------------------------
- -- application
- -- -------------------------------
- local function debug(txt)
- local hFile
- if fs.exists(LOG_FILE_NAME) then
- hFile = fs.open(FILE_NAME, "a");
- else
- hFile = fs.open(FILE_NAME, "w");
- end
- hFile.writeLine(txt);
- hFile.close();
- end
- -- -------------------------------
- -- main
- -- -------------------------------
- print("log_client(remote log receiver)")
- print("receive() ...")
- while true do
- rednet.open(MODEM_DIR)
- local sdrId, msg, dist = rednet.receive()
- rednet.close()
- if PRINT_ENABLED then
- print(tostring(sdrId)..","..tostring(dist)..","..msg)
- end
- rednet.close(MODEM_DIR)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement