farmbot开发入门教程-lua 消息
说明:
- 介绍FarmBot OS 中的消息传递 Lua 函数列表
调试(消息)
- 发送类型为 的日志debug。
debug("This just happened")
发送消息(类型,消息,渠道?)
向日志频道发送一条消息,并可选择以祝酒词、电子邮件或合成口语的形式发送。
- 第一个必需参数是 log ,它必须是type以下字符串值之一:assertion,,,,,,,,,。busydebugerrorfuninfosuccesswarn
- 第二个必需参数是消息,它可以是字符串或数字。
- 第三个参数是可选的,可以是单个字符串或字符串数组。字符串必须是以下可用通道之一:toast、email、espeak。
-- Send an error message to the default logs channel:
send_message("error", "Movement failed.")
-- Send a success message to the logs channel and by email:
send_message("success", "You've got mail!", "email")
-- Send a message to the logs channel and multiple other channels:
send_message("info", "All systems running.", {"toast", "espeak"})
-- Compose and send a more complex message:
local position = get_xyz()
local message = "Movement failed. " ..
"The FarmBot is currently at (" ..
position.x .. ", " ..
position.y .. ", " ..
position.z ..
") and is not moving."
send_message("error", message, {"toast", "email"})
吐司(消息,类型?)
- 将消息作为 toast 通知发送到日志频道。info如果未指定类型,则默认为类型。
-- Send a toast notification:
toast("This is a toast")
wait(1000)
-- Send a toast notification with a different type:
toast("I'll cheers to that", "success")
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号