Skip to content

Commit ebd87ff

Browse files
authored
fix docs: read/write_model takes only one parameter (#336)
1 parent 6af254a commit ebd87ff

File tree

1 file changed

+2
-2
lines changed
  • docs/pages/framework/world

1 file changed

+2
-2
lines changed

docs/pages/framework/world/api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ In the case that your model defines several [keys](/framework/models#the-key-att
5050
let player = get_caller_address();
5151
let location = 0x1234;
5252

53-
let mut position: Position = world.read_model(player, location);
53+
let mut position: Position = world.read_model((player, location));
5454
```
5555

5656
If you use the `read_model` command on a model that has never been set before, all the fields that are not `#[key]` are equal to 0 in the returned model, which is the default value in the storage. As you provide the keys, even if the model has never been written, the returned struct will contain the keys you provided.
@@ -64,7 +64,7 @@ let player = get_caller_address();
6464
let location = 0x1234;
6565

6666
// Read the model from the world state.
67-
let mut position: Position = world.read_model(player, location);
67+
let mut position: Position = world.read_model((player, location));
6868

6969
// Update the model.
7070
position.vec.x = 10;

0 commit comments

Comments
 (0)