The rednet.receive() will yield the entire program until an actual message is recieved. Like if you wanted to do other things while you wait for the message to come in like monitor clicks, timers, redstone events i would recommend doing something like the following for your logging computer
while true do
local ev = { os.pullEvent() }
if ev[1] == "modem_message" or ev[1] == "rednet_message" then
local file = fs.open('log','a')
file.writeLine(textutils.serialize(ev))
file.close()
end
end
while true do:
keep it running in a loop to log every action recieved
local ev = { os.pullEvent() }
declare a local var 'ev' which is a table that stores everything os.pullEvent returns
if ev[1] == "modem_message" or ev[1] == "rednet_message"
for backwards compatibility on the Rednet API or the Modem API
local file = fs.open('log','a')
declare a local var 'file' to open a file handle 'log' in append mode which will keep its current data in the file
file.writeLine(textutils.serialize(ev))
turn the table into a string and write to file
file.close()
close the file handle and save data
Edited by Cozzimoto, 17 November 2013 - 09:22 AM.