Difference between revisions of "enet.peer:round trip time"

(Created page with "Returns or sets the current round trip time (i.e. ping). If value is nil the current value of the peer is returned. Otherwise the round trip time is set to th...")
 
(Separated the two functionalities.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
Returns or sets the current round trip time (i.e. ping). If value is [[nil]] the current value of the [[enet.peer | peer]] is returned. Otherwise the round trip time is set to the specified value and returned.
 
Returns or sets the current round trip time (i.e. ping). If value is [[nil]] the current value of the [[enet.peer | peer]] is returned. Otherwise the round trip time is set to the specified value and returned.
  
ENet performs some filtering on the round trip times and it takes some time until the parameters are accurate.
+
ENet performs some filtering on the round trip times and it takes some time until the parameters are accurate. To speed it up, set the [[enet.peer:last_round_trip_time | last round trip time]] to an accurate guess.
 
== Function ==
 
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
peer:round_trip_time()
 +
</source>
 +
=== Arguments ===
 +
None.
 +
=== Returns ===
 +
{{param|number|roundtriptime|The [[enet.peer | peer's]] current round trip time in milliseconds.}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 8: Line 16:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|value|Optional integer value to be used as the new round trip time.}}
+
{{param|number|value|Integer value to be used as the new round trip time.}}
 
=== Returns ===
 
=== Returns ===
{{param|number|roundtriptime|The [[enet.peer | peer's]] current round trip time in milliseconds.}}
+
Nothing.
  
 
== See Also ==
 
== See Also ==
 
* [[parent::lua-enet]]
 
* [[parent::lua-enet]]
 
* [[enet.peer]]
 
* [[enet.peer]]
 +
* [[enet.peer:last_round_trip_time]]
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|enet.peer:round_trip_time}}
 
{{i18n|enet.peer:round_trip_time}}

Latest revision as of 02:09, 30 October 2016

Returns or sets the current round trip time (i.e. ping). If value is nil the current value of the peer is returned. Otherwise the round trip time is set to the specified value and returned.

ENet performs some filtering on the round trip times and it takes some time until the parameters are accurate. To speed it up, set the last round trip time to an accurate guess.

Function

Synopsis

peer:round_trip_time()

Arguments

None.

Returns

number roundtriptime
The peer's current round trip time in milliseconds.

Synopsis

peer:round_trip_time(value)

Arguments

number value
Integer value to be used as the new round trip time.

Returns

Nothing.

See Also

Other Languages