So i suggest a new queued event system. When an event occurs it is added to the "queue", os.pullEvent() pulls the oldest event (or oldest event of the specified type). The event would be removed from the queue once it has been called.
Example:
Events that have happened:
Rednet message received (newest)
Player presses Q
Rednet message received
Disk inserted
Alarm set off (oldest)
The queue would look like this:
rednet_message,8,"blahaha"
char,"q"
rednet_message,2,"hai"
disk,3
alarm,3
Pseudo Code:
(vars) = os.pullEvent("rednet_message")
(vars) = os.pullEvent()
Resulting queuerednet_message,8,"blahaha"
char,"q"
disk,3
The first one would return the second rednet message ("hai" from ID 2) and the second command would return the alarm. Note something here, even though the rednet message "hai" was called (being the oldest rednet message) the computer still returned to the start of the list, so the next (unlimited) call returned the alarm (as such a good program should cycle through all the events ignoring the ones it doesn't want. Using the selective feature always would cause a giant queue to build up).
EDIT:
People seem sure this is implemented, BUT:
It doesn't seem to be working with rednet.
On the first computer I opened the LUA console, booted rednet and prepared the command:
rednet.broadcast("Oh hai!")
On the second I wrote the following script
rednet.open("left")
sleep(8)
local i, i2 = os.pullEvent()
print(i..i2)
Then I ran the script and quickly ran the command on the first computer, the second computer slept for a while and then waited for a command- no luck.
Does this work with rednet?
EDIT2: I did the same test, hitting "space" after I ran the script, it did not pick up the space (which should have been queued, after the computer stopped sleeping and moved onto the os.pullEvent() command I was able to hit it to end the program).












