Skip to content

Commit

Permalink
Replaces deprecated #[init(default = ...)] with #[init(val = ...)] (
Browse files Browse the repository at this point in the history
#73)

The attribute key #[init(val = ...)] replaces #[init(default = ...)].
More information on godot-rust/gdext#844
  • Loading branch information
ColinWttt authored Feb 2, 2025
1 parent 5949aad commit 212374e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/register/constructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct Monster {
}
```

To provide another default value, use `#[init(default = value)]`. This should only be used for simple cases, as it may lead to difficult-to-read
To provide another default value, use `#[init(val = value)]`. This should only be used for simple cases, as it may lead to difficult-to-read
code and error messages. This API may also still change.

```rust
Expand All @@ -53,7 +53,7 @@ code and error messages. This API may also still change.
struct Monster {
name: String, // initialized to ""

#[init(default = 100)]
#[init(val = 100)]
hitpoints: i32, // initialized to 100

base: Base<Node3D>, // wired up
Expand Down

0 comments on commit 212374e

Please sign in to comment.