Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
api:event [2016/06/16 08:14]
payonel
api:event [2017/06/11 02:35]
payonel
Line 48: Line 48:
 To only pull clicks by player "​Steve"​ you'd do:  ​ To only pull clicks by player "​Steve"​ you'd do:  ​
   `local _, x, y = event.pull("​click",​ nil, nil, "​Steve"​)`   `local _, x, y = event.pull("​click",​ nil, nil, "​Steve"​)`
-- `event.pullFiltered(([timeout: number], [filter: function]): string, ...` (Since 1.5.9)+- `event.pullFiltered([timeout:​ number], [filter: function]): string, ...` (Since 1.5.9)
 Pulls and returns the next available event from the queue, or waits until one becomes available but allows filtering by specifying filter function. Pulls and returns the next available event from the queue, or waits until one becomes available but allows filtering by specifying filter function.
 **timeout** - if passed the function will wait for a new event for this many seconds at maximum then returns `nil` if no event was queued during that time.\\ **timeout** - if passed the function will wait for a new event for this many seconds at maximum then returns `nil` if no event was queued during that time.\\
Line 80: Line 80:
 - `event.pullMultiple(...):​ ...` (Since 1.5.9) - `event.pullMultiple(...):​ ...` (Since 1.5.9)
 As its arguments `pullMutliple` accepts multiple event names to be pulled, allowing basic filtering of multiple events at once. As its arguments `pullMutliple` accepts multiple event names to be pulled, allowing basic filtering of multiple events at once.
-- `event.shouldSoftInterrupt():​ boolean` (Since 1.5.9) 
-This function is called by `event.pull` after each signal was processed, to check whether it should abort early. If this returns `true`, `event.pull` will return an `interrupted` event if the filtering allows for that.  ​ 
-Per default, this returns `true` if the combination `Ctrl + C` is pressed.  ​ 
-This should usually not be called by your programs. 
-- `event.shouldInterrupt():​ boolean`  ​ 
-This function is called by `event.pull` after each signal was processed, to check whether it should abort early. If this returns `true`, `event.pull` will throw an `interrupted` error.  ​ 
-Per default, this returns `true` if the combination `Ctrl + Alt + C` is pressed.  ​ 
-This should usually not be called by your programs, except if you need to do some cleanup if the program is manually interrupted. 
 - `event.onError(message:​ any)`  ​ - `event.onError(message:​ any)`  ​
 Global event callback error handler. If an event listener throws an error, we handle it in this function to avoid it bubbling into unrelated code (that only triggered the execution by calling `event.pull`). Per default, this logs errors into a file on the temporary file system.  ​ Global event callback error handler. If an event listener throws an error, we handle it in this function to avoid it bubbling into unrelated code (that only triggered the execution by calling `event.pull`). Per default, this logs errors into a file on the temporary file system.  ​
Line 93: Line 85:
  
 ===== Interrupts ===== ===== Interrupts =====
-Interrupts are a type of messaging intended to close or stop a process. ​In OpenOS ​the `event.pull*()` methods generate the two types of interrupts.+Starting ​In OpenOS ​1.6.4 and later, ​interrupts ​have been cleaned upThe following two methods are now obsolete
  
-They are especially useful when `event.pull*()` is called without time limit and without ​filter. In some cases this means that `event.pull*()` could be waiting indefinitely.+- `event.shouldSoftInterrupt():​ boolean` (Since 1.5.9 and removed in 1.6.4) 
 +- `event.shouldInterrupt():​ boolean` ​ (Since 1.5.9 and removed in 1.6.4) 
 + 
 +Interrupts are a type of messaging intended to close or stop a process. In OpenOS the `computer.pullSignal()`,​ and thus any wrapper, generates 2 types of events. 
 + 
 +They are especially useful when `event.pull*()` is called without time limit and with a filter. In some cases this means that `event.pull*()` could be waiting indefinitely. 
 + 
 +- Soft interrupts are an event signal generated by pressing `Ctrl+C`. The signal returns two fields, the event name `"​interrupted"​` and the computer uptime
  
-- Soft interrupts are generated by pressing `Ctrl+C` and is only effective if `event.pull*()` allows for returning this type of event (`"​interrupted"​`). It also returns one additional result which is time spent in `event.pull*()`. 
 - Hard interrupts are generated by pressing `Ctrl-Alt-C`. It forcibly exits the `event.pull*()` method by throwing a `"​interrupted"​` error. - Hard interrupts are generated by pressing `Ctrl-Alt-C`. It forcibly exits the `event.pull*()` method by throwing a `"​interrupted"​` error.