mirror of
https://github.com/m5stack/ESP-Claw.git
synced 2026-05-20 11:51:49 -07:00
feat: optimized the skill loading method
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
# Lua Event Publisher
|
||||
|
||||
This skill describes how to correctly use event_publisher when writing Lua scripts.
|
||||
|
||||
## How to call
|
||||
- Import it with `local event_publisher = require("event_publisher")`
|
||||
- Call `event_publisher.publish_message({...})` to publish a message event
|
||||
- Call `event_publisher.publish_trigger({...})` to publish a trigger event
|
||||
- Call `event_publisher.publish({...})` to publish a full custom event
|
||||
|
||||
## Example
|
||||
```lua
|
||||
local event_publisher = require("event_publisher")
|
||||
|
||||
event_publisher.publish_message({
|
||||
source_cap = "lua_script",
|
||||
channel = "custom",
|
||||
chat_id = "demo",
|
||||
text = "hello"
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"id": "lua_module_event_publisher",
|
||||
"file": "lua_module_event_publisher.md",
|
||||
"title": "lua_module_event_publisher",
|
||||
"summary": "How to publish message, trigger, and custom events from Lua.",
|
||||
"cap_groups": [
|
||||
"cap_lua"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user