Posted 17 April 2012 - 11:12 AM
Proposal
A function that will return a list of events, with the data in table form.
If enabled (os.logEvents(true)), events are added to this table with the tick they occurred.
The table includes the global 'tick' time from the World class (as a raw large number), so speed of events can be measured.
A call to os.getNewEvents() returns this table, and removes all entries to the log (so you always get new events you haven't already seen)
Benefits
You don't miss out on events happening while a turtle is moving, or a function takes longer then 0.05s to complete.
You can measure the differences between ticks, and so can time actions better (as SMP server's tick rates are unreliable)
Fast redstone circuits would no longer 'skip', as a rapidly toggling input does not always line up with os.pullEvent and events can be missed.
Example data
It would be ideal to return something like this….
A function that will return a list of events, with the data in table form.
If enabled (os.logEvents(true)), events are added to this table with the tick they occurred.
The table includes the global 'tick' time from the World class (as a raw large number), so speed of events can be measured.
A call to os.getNewEvents() returns this table, and removes all entries to the log (so you always get new events you haven't already seen)
Benefits
You don't miss out on events happening while a turtle is moving, or a function takes longer then 0.05s to complete.
You can measure the differences between ticks, and so can time actions better (as SMP server's tick rates are unreliable)
Fast redstone circuits would no longer 'skip', as a rapidly toggling input does not always line up with os.pullEvent and events can be missed.
Example data
It would be ideal to return something like this….
World Tick Event ID Data
2876583096 redstone [side="left", type="bundled", state=126, previous=84]
2876583142 timer [id=5]
2876583142 redstone [side="right", type="simple", state=true]
2876583142 rednet [senderID=241, distance=45.4, message="A test message"]