Skip to content

Commit

Permalink
docs(guides/extending): update /core/ to the new /init/ (latticex…
Browse files Browse the repository at this point in the history
  • Loading branch information
qbzzt authored Mar 10, 2024
1 parent 1a82c27 commit a3d8966
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/pages/guides/extending-a-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ The easiest way to create the Solidity code is to use the MUD template:
import { console } from "forge-std/console.sol";
import { IBaseWorld } from "@latticexyz/world-modules/src/interfaces/IBaseWorld.sol";
import { WorldRegistrationSystem } from "@latticexyz/world/src/modules/core/implementations/WorldRegistrationSystem.sol";
import { WorldRegistrationSystem } from "@latticexyz/world/src/modules/init/implementations/WorldRegistrationSystem.sol";
// Create resource identifiers (for the namespace and system)
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
Expand Down Expand Up @@ -253,10 +253,10 @@ The easiest way to create the Solidity code is to use the MUD template:
Use [IBaseWorld.sol](https://github.com/latticexyz/mud/blob/main/packages/world-modules/src/interfaces/IBaseWorld.sol) to get definitions that are common to all `World` contracts.

```solidity
import { WorldRegistrationSystem } from "@latticexyz/world/src/modules/core/implementations/WorldRegistrationSystem.sol";
import { WorldRegistrationSystem } from "@latticexyz/world/src/modules/init/implementations/WorldRegistrationSystem.sol";
```

[WorldRegistartionSystem.sol](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol) contains the function definitions necessary to register new namespaces and systems with an existing `World`.
[WorldRegistartionSystem.sol](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol) contains the function definitions necessary to register new namespaces and systems with an existing `World`.

```solidity
// Create resource identifiers (for the namespace and system)
Expand Down Expand Up @@ -352,7 +352,7 @@ The easiest way to create the Solidity code is to use the MUD template:
world.registerNamespace(namespaceResource);
```

[Register the namespace](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L39-L63).
[Register the namespace](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L39-L63).

```solidity
StoreSwitch.setStoreAddress(worldAddress);
Expand Down Expand Up @@ -404,7 +404,7 @@ The easiest way to create the Solidity code is to use the MUD template:
cast send $WORLD_ADDRESS --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY "messaging__incrementMessage(string)" "hello"
```

When a function is _not_ in the root namespace, it is accessible as `<namespace>__<function name>` (as long as it is [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L164-L201)).
When a function is _not_ in the root namespace, it is accessible as `<namespace>__<function name>` (as long as it is [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L164-L201)).

Here we call our `incrementMessage(string)` with the parameter `hello`.

Expand Down

0 comments on commit a3d8966

Please sign in to comment.