Skip to content

Commit

Permalink
Merge pull request #194 from xj5027/patch-1
Browse files Browse the repository at this point in the history
Update messaging.md
  • Loading branch information
PSkinnerTech committed May 7, 2024
2 parents f8edcd5 + 92a86e7 commit eacf291
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/zh/tutorials/begin/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ aos
我们将使用下面提供的进程 ID 并将其存储为名为 `Morpheus` 的变量。

```lua
P2RS2VtQ4XtYEvAXYDulEA9pCBCIRpJDcakTR9aW434
wu_tAUDUveetQZpcN8UxHt51d9dyUkI4Z-MfQV8LnUU
```

通过复制上面的进程 ID 并在 aos CLI 中运行以下命令以便将其存储为变量:

```lua
Morpheus = "P2RS2VtQ4XtYEvAXYDulEA9pCBCIRpJDcakTR9aW434"
Morpheus = "wu_tAUDUveetQZpcN8UxHt51d9dyUkI4Z-MfQV8LnUU"
```

这会将进程 ID 存储为名为 `Morpheus` 的变量,从而更轻松地与特定进程 ID 进行交互。
Expand All @@ -64,8 +64,8 @@ Morpheus = "P2RS2VtQ4XtYEvAXYDulEA9pCBCIRpJDcakTR9aW434"
-- 通过输入 `Morpheus` 检查 Morpheus 变量
Morpheus
-- 预期结果:
P2RS2VtQ4XtYEvAXYDulEA9pCBCIRpJDcakTR9aW434
aos>
wu_tAUDUveetQZpcN8UxHt51d9dyUkI4Z-MfQV8LnUU


-- 如果 `undefined` 被返回,
-- 那么变量没有创建成功。
Expand All @@ -90,8 +90,7 @@ Send({ Target = Morpheus, Data = "Morpheus?"})
-- 消息已添加到发件箱
message added to outbox
-- 从 `Morpheus` 的进程 ID 收到一条新消息
New Message From P2R...434: Data = I am here. You are f
aos>
New Message From BWM...ulw: Data = I am here. You are f
```

你已向 Morpheus 发送了一条消息并收到了回复,但你无法阅读完整的消息。 让我们了解 `收件箱` 以及如何阅读消息。
Expand All @@ -117,18 +116,17 @@ aos>

```lua
-- 你的 `收件箱` 命令
aos> #Inbox
#Inbox
-- 该命令将返回你收件箱中的消息数量
4
aos>
```

在上面的示例中,返回为 `4`,表示收件箱中有四封邮件。

由于我们主要是为了寻找 `Morpheus` 的回复,因此我们假设他的消息是最后收到的消息。要阅读收件箱中的最后一条消息,请键入以下命令:

```lua
aos> Inbox[#Inbox].Data
Inbox[#Inbox].Data
```

该命令允许你将数据与消息分离,并且仅读取特定数据字段的内容。
Expand All @@ -137,12 +135,11 @@ aos> Inbox[#Inbox].Data

```lua
-- 你的 Inbox[x].Data 命令
aos> Inbox[#Inbox].Data
Inbox[#Inbox].Data
-- 该命令将返回消息的 `Data` 字段。
-- Data 通常代表基于文本的消息
-- 从一个进程接收到另一进程。
I am here. You are finally awake. Are you ready to see how far the rabbit hole goes?
aos>
```

你现在正在使用自己的进程与 Morpheus 进行通信,Morpheus 是 ao 中运行的另一个并行进程。 你现在已准备好继续本教程的下一步。
Expand Down

0 comments on commit eacf291

Please sign in to comment.