Skip to content

Commit

Permalink
Fix various code examples in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
raulsntos committed Dec 21, 2024
1 parent 90f21a3 commit 2a90da4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
GD.Print(array[0]); // Prints "First"
GD.Print(array[2]); // Prints 3
GD.Print(array[array.Count - 1]); // Prints "Last"
GD.Print(array[^1]); // Prints "Last"

array[2] = "Second";
array[1] = "Second";
GD.Print(array[1]); // Prints "Second"
GD.Print(array[array.Count - 3]); // Prints "Second"
GD.Print(array[^3]); // Prints "Second"
[/csharp]
[/codeblocks]
[b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/DTLSServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if dtls_peer.get_status() != PacketPeerDTLS.STATUS_HANDSHAKING:
continue # It is normal that 50% of the connections fails due to cookie exchange.
print("Peer connected!")
peers.append(dtls_peer)
peers.append(TlsOptions.server(dtls_peer))

for p in peers:
p.poll() # Must poll to update the state.
Expand Down Expand Up @@ -57,7 +57,7 @@

public override void _Process(double delta)
{
while (Server.IsConnectionAvailable())
while (_server.IsConnectionAvailable())
{
PacketPeerUdp peer = _server.TakeConnection();
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
Expand All @@ -66,7 +66,7 @@
continue; // It is normal that 50% of the connections fails due to cookie exchange.
}
GD.Print("Peer connected!");
_peers.Add(dtlsPeer);
_peers.Add(TlsOptions.Server(dtlsPeer));
}

foreach (var p in _peers)
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/Window.xml
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,13 @@
[/gdscript]
[csharp]
// Set region, using Path2D node.
GetNode<Window>("Window").MousePassthrough = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();

// Set region, using Polygon2D node.
GetNode<Window>("Window").MousePassthrough = GetNode<Polygon2D>("Polygon2D").Polygon;
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Polygon2D>("Polygon2D").Polygon;

// Reset region to default.
GetNode<Window>("Window").MousePassthrough = new Vector2[] {};
GetNode<Window>("Window").MousePassthroughPolygon = new Vector2[] {};
[/csharp]
[/codeblocks]
[b]Note:[/b] This property is ignored if [member mouse_passthrough] is set to [code]true[/code].
Expand Down

0 comments on commit 2a90da4

Please sign in to comment.