Difference between revisions of "Receiving a rednet message through os.pullEvent()"
From ComputerCraft Wiki
(→Explanation) |
|||
Line 12: | Line 12: | ||
end | end | ||
− | + | What a pleasure to find soemone who identifies the issues so clearly | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 13:41, 17 July 2012
The following method is a good method of receiving a rednet message without using rednet.receive(). It is usually used in IRC, Chat programs e.t.c. When a message arrives to a computer, a "rednet_message" event occurs.
The Code
This is a typical Listener which prints the content and the sender id of any incoming message.
rednet.open("Direction_of_modem") while true do event, id, text = os.pullEvent() if event == "rednet_message" then print(id .. "> " .. text) end end
What a pleasure to find soemone who identifies the issues so clearly