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 [2017/06/11 02:35]
payonel
api:event [2017/06/11 02:39]
payonel
Line 34: Line 34:
 **Returns:​** a timer ID that can be used to cancel the timer at any time.\\ **Returns:​** a timer ID that can be used to cancel the timer at any time.\\
 //Note//: the timer resolution can vary. If the computer is idle and enters sleep mode, it will only be woken in a game tick, so the time the callback is called may be up to 0.05 seconds off.  ​ //Note//: the timer resolution can vary. If the computer is idle and enters sleep mode, it will only be woken in a game tick, so the time the callback is called may be up to 0.05 seconds off.  ​
-**Important**:​ timers are driven by the `event.pull` function. If you always pull signals directly from `os.pullSignal` and never call `event.pull`,​ timers will not work! 
 - `event.cancel(timerId:​ number): boolean`  ​ - `event.cancel(timerId:​ number): boolean`  ​
 Cancels a timer previously created with `event.timer`.  ​ Cancels a timer previously created with `event.timer`.  ​
Line 45: Line 44:
 **...** - any number of parameters in the same order as defined by the [[component:​signals|signal]] that is expected. Those arguments will act as filters for the additional arguments returned by the signal. Direct equality is used to determine if the argument is equal to the given filter. Can be `nil` in which case this particular argument will not be filtered.\\ **...** - any number of parameters in the same order as defined by the [[component:​signals|signal]] that is expected. Those arguments will act as filters for the additional arguments returned by the signal. Direct equality is used to determine if the argument is equal to the given filter. Can be `nil` in which case this particular argument will not be filtered.\\
 Filter example:  ​ Filter example:  ​
-The `click` signal (when a player clicks on a tier two or three screen) has the signature ` screenX: number, screenY: number, playerName: string`  ​+The `touch` signal (when a player clicks on a tier two or three screen) has the signature ` screenX: number, screenY: number, playerName: string`  ​
 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("​touch", 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.