Skip to content

Commit

Permalink
docs: prettier (#1213)
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1a authored Jul 31, 2023
1 parent 16d8c43 commit b24502c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/pages/world/world-101.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,19 @@ Now we can import our new table, and write something to it. Let’s write a func
pragma solidity >=0.8.0;
import { System } from "@latticexyz/world/src/System.sol";
import { Dog, DogData } from "../codegen/tables/Dog.sol"; // import table we created
contract MySystem is System {
function addEntry(string memory name, string memory color) public returns (bytes32) {
bytes32 key = bytes32(abi.encodePacked(block.number, msg.sender, gasleft())); // creating a random key for the record
address owner = _msgSender(); // IMPORTANT: always refer to the msg.sender using the _msgSender() function
Dog.set(key, DogData({owner: owner, name: name, color: color})); // creating our record!
Dog.set(key, DogData({ owner: owner, name: name, color: color })); // creating our record!
return key;
}
}
```

That’s it! `MySystem`, just like `IncrementSystem`, will have access to Dog given they are in the same namespace.


We can run `pnpm mud worldgen` in the contract folder to recreate the systems.

```bash
Expand Down

0 comments on commit b24502c

Please sign in to comment.