Difference between revisions of "enet.event"

(Created page with "== Description == An event is a table generated by host:service() or peer:recieve() which will '''always''' conta...")
 
m (Other Languages)
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Description ==
 
== Description ==
An [[enet.event | event]] is a table generated by [[enet.host:service | host:service()]] or [[enet.peer:receive | peer:recieve()]] which will '''always''' contain a [[string]] named ''type'', a ''[[enet.peer]]'' named ''peer'', and a [[string]] or [[number]] named ''data'' depending on the kind of event.
+
An [[enet.event | event]] is a table generated by [[enet.host:service | host:service()]] or [[enet.peer:receive | peer:receive()]] which will '''always''' contain a [[string]] named ''type'', a [[enet.peer]] named ''peer'', and a [[string]] or [[number]] named ''data'' depending on the kind of event.
 +
 
 +
Though be wary that [[enet.host:service | host:service()]] and [[enet.peer:receive | peer:receive()]] can return [[nil]] if no events are in the queue.
  
 
== Structure ==
 
== Structure ==
Line 25: Line 27:
 
* [[enet.host:service]]
 
* [[enet.host:service]]
 
* [[enet.peer:receive]]
 
* [[enet.peer:receive]]
 +
 +
== Other Languages ==
 +
{{i18n|enet.event}}

Revision as of 07:31, 14 June 2019

Description

An event is a table generated by host:service() or peer:receive() which will always contain a string named type, a enet.peer named peer, and a string or number named data depending on the kind of event.

Though be wary that host:service() and peer:receive() can return nil if no events are in the queue.

Structure

event.type event.peer event.data
"receive" peer string
"disconnect" peer number
"connect" peer number

See Also

Other Languages