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: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: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: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:flush

enet.host:flush Sends any queued packets. This is only required to send packets earlier than the next call to host:service, or if host:service will not be called again. Function Synopsis host:flush() Arguments None. Returns Nothing. See Also lua-enet enet.host:service enet.host

enet.host:destroy

enet.host:destroy Destroys the host structure and closes all of its connections. This function is also ran automatically by lua's garbage collector, since it's an alias to host:__gc. Function Synopsis host:destroy() Arguments None. Returns Nothing. See Also lua-enet enet.host

enet.host:connect

enet.host:connect Connects a host to a remote host. Returns peer object associated with the remote host. The actual connection will not take place until the next host:service() is called, in which a "connect" event will be generated. Function Synopsis peer = host:connect(address, channel_count, data) Arguments string address The address to connect to in the format "ip:port". number channel_count The number of channels to allocate. It should be the same as the channel count on the serve

enet.host:compress with range coder

enet.host:compress with range coder Toggles an adaptive order-2 PPM range coder for the transmitted data of all peers. Function Synopsis host:compress_with_range_coder() Arguments None. Returns boolean state True if the compression algorithm is active, false if not. See Also lua-enet enet.host

enet.host:check events

enet.host:check events Checks for any queued events and dispatches one if available. Returns the associated event if something was dispatched, otherwise nil. Function Synopsis event = host:check_events() Arguments None. Returns table event An event or nil if no events are available. See Also lua-enet enet.event enet.host:service