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:39]
payonel
api:event [2017/07/20 07:06]
payonel [Functions]
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.
 ``` ```
  
Line 82: Line 82:
 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.  ​
 You can replace this function with your own if you want to handle event errors in a different way. You can replace this function with your own if you want to handle event errors in a different way.
 +- `event.push(name:​ string[, ...])`  ​
 +This is only an alias to [[api:​computer|computer.pushSignal]]. This does not modify the arguments in any way. It seemed logical to add the alias to the event library because there is also an `event.pull` for signals.
 +
  
 ===== Interrupts ===== ===== Interrupts =====