enet.host:get peer

enet.host:get peer Returns the connected peer at the specified index (starting at 1). ENet stores all peers in an array of the corresponding host and re-uses unused peers for new connections. You can query the state of a peer using peer:state(). Function Synopsis host:get_peer(index) Arguments number index The index of the desired peer. Returns enet.peer peer The desired peer structure. See Also lua-enet enet.host enet.peer

enet.host:get socket address

enet.host:get socket address Returns a string that describes the socket address of the given host. The string is formatted as “a.b.c.d:port”, where “a.b.c.d” is the IP address of the used socket. Function Synopsis host:get_socket_address() Arguments None. Returns string address A string that describes the socket address. See Also lua-enet enet.host

enet.host:peer count

enet.host:peer count Returns the number of peers that are allocated for the given host. This represents the maximum number of possible connections. Function Synopsis host:peer_count() Arguments None. Returns number limit The maximum number of peers allowed. See Also lua-enet enet.host enet.peer

enet.host:service

enet.host:service Wait for events, send and receive any ready packets. If an event is in the queue it will be returned and dequeued. Generally you will want to dequeue all waiting events every frame. Function Synopsis event = host:service( timeout ) Arguments number timeout The max number of milliseconds to be waited for an event. Default is 0. Returns table event An event or nil if no events occured. See Also lua-enet enet.event

enet.host:service time

enet.host:service time Returns the time-stamp of the last call to host:service() or host:flush(). The time-stamp is in milliseconds of the current time of day. Function Synopsis host:channel_limit(limit) Arguments None. Returns number timestamp A time-stamp in milliseconds. See Also lua-enet enet.host enet.host:service enet.host:flush

enet.host:total received data

enet.host:total received data Returns the number of bytes that were received by the given host. Function Synopsis host:total_received_data() Arguments None. Returns number bytes The total number of bytes received. See Also lua-enet enet.host enet.host:total_sent_data

enet.host:total sent data

enet.host:total sent data Returns the number of bytes that were sent through the given host. Function Synopsis host:total_sent_data() Arguments None. Returns number bytes The total number of bytes sent. See Also lua-enet enet.host enet.host:total_received_data

enet.linked version

enet.linked version Returns the included ENet's version as a string. Function Synopsis version = enet.linked_version() Arguments None. Returns string version ENet's version. See Also lua-enet

enet.peer

enet.peer Description An ENet peer which data packets may be sent or received from. In most applications you'll manually keep track of connected peers. Functions Function Description peer:disconnect Requests a disconnection from the peer. peer:disconnect_now Force immediate disconnection from peer. peer:disconnect_later Request a disconnection from peer, but only after all queued outgoing packets are sent. peer:reset Forcefully disconnects peer. The peer is not notified of the

enet.peer:connect id

enet.peer:connect id Returns the field ENetPeer::connectID that is assigned for each connection. Function Synopsis peer:connect_id() Arguments None. Returns number id Unique ID that was assigned to the connection. See Also lua-enet enet.peer