如何从对象消息中检索变量?

How to retrieve a variable from the object msg?

我是 node-red 的新手,我一直在尝试按照文档 http://nodered.org/docs/writing-functions.html
的示例创建一个新变量 这是代码:

// initialise the counter to 0 if it doesn't exist already
var count = context.get('count')||0;
count += 1;
// store the value back
context.set('count',count);
// make it part of the outgoing msg object
msg.count = count;
return msg;

但是我在使用变量 msg.count 时遇到了麻烦。我已经发出一条消息,试图通过多次尝试打印该值,例如 {msg.count}{msg.get('count')} 但它每次都写 undefined 或什么都不写。
如何打印变量计数?
这就是流程的样子,开关只是检查 msg.count.

的值

我尝试的太复杂了。
我只需要使用 {count} 而不是 {msg.count}.