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:37]
payonel
api:event [2017/06/11 02:45]
payonel
Line 44: 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.
Line 57: Line 57:
 local allowedPlayers = {"​Kubuxu",​ "​Sangar",​ "​Magik6k",​ "​Vexatos"​} local allowedPlayers = {"​Kubuxu",​ "​Sangar",​ "​Magik6k",​ "​Vexatos"​}
 local function filter(name,​ ...) local function filter(name,​ ...)
-  if name ~= "​key_up"​ and name ~= "​key_down"​ and name ~= "click" then+  if name ~= "​key_up"​ and name ~= "​key_down"​ and name ~= "touch" then
     return false     return false
   end   end
   local nick   local nick
-  if name == "click" then+  if name == "touch" then
     nick = select(3, ...)     nick = select(3, ...)
   else   else
Line 74: Line 74:
 end end
  
-local e = {event.pullFiltered(filter)} ​ -- We are pulling key_up, key_down and click events for unlimited amount of time. The filter will ensure that only evets caused by players in allowedPlayers are pulled.+local e = {event.pullFiltered(filter)} ​ -- We are pulling key_up, key_down and click events for unlimited amount of time. The filter will ensure that only events ​caused by players in allowedPlayers are pulled.
 ``` ```