Skip to content
cccskills
FreePublished on GitHub

bee-lua

bee.lua 运行时库指南——Lua 5.4/5.5 上的跨平台系统级绑定(异步 I/O、网络、子进程、线程、文件系统、文件监控、崩溃 dump)。

当需要在本项目里编写、修改或排查使用 `require "bee.*"` 的 Lua 代码,涉及 socket/select/epoll/async、thread/channel/serialization、subprocess、filesystem/filewatch、time/sys/crash/debugging/windows,或需要按平台差异处理行为时,使用本 skill。

即使用户没有明确提到 bee.lua,只要上下文是在调用 `bee` 命名空间下的模块,也应使用。不要用于纯 Lua 语言/标准库问题、与 bee 无关的第三方 C 模块,或本项目 C++ 层 `bee/`、`binding/` 的实现细节(那些看源码)。

The English summary is being prepared. Showing the original description.

actboy168/bee.lua195 stars(GitHub 195 + cccskills 0)

Run score Not tested

See how to install

Files included (1)

  • SKILL.md3.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

bee.lua

Lua 扩展库,为 Lua 5.4 / 5.5 提供系统级原生绑定。

API 参考来源

本 skill 不维护 bee 的 API 签名表,以仓库里的文件为唯一权威来源:

目的来源
函数签名、参数/返回值类型、字段与常量meta/<module>.lua(LuaLS/EmmyLua 注解,带中文说明)
行为契约、错误文案、边界情况、可运行示例test/test_<module>.lua
构建与测试命令、测试规范AGENT.md
C++ 层实现细节bee/、binding/lua_<module>.cpp

模块索引

模块meta用途
bee.platformmeta/platform.lua平台/编译器/架构信息(纯数据表)
bee.filesystemmeta/filesystem.lua路径与文件系统操作
bee.serializationmeta/serialization.lua序列化(线程/通道的底层)
bee.timemeta/time.lua墙钟 / 单调 / 线程 CPU 时间
bee.sysmeta/sys.lua可执行文件路径、文件锁
bee.socketmeta/socket.luaTCP/UDP/Unix socket
bee.selectmeta/select.luaselect 风格多路复用
bee.epollmeta/epoll.luaepoll 风格多路复用(Windows 走 IOCP)
bee.asyncmeta/async.lua异步 I/O(IOCP / io_uring / GCD)
bee.filewatchmeta/filewatch.lua文件监控
bee.threadmeta/thread.lua线程
bee.channelmeta/channel.lua线程间通信
bee.subprocessmeta/subprocess.lua子进程与管道
bee.windowsmeta/windows.luaWindows 专有工具
bee.crashmeta/crash.lua崩溃 dump
bee.debuggingmeta/debugging.lua断点 / 调试器探测

跨模块约定

  • 模块都在 bee.* 命名空间:local socket = require "bee.socket"。
  • 三态返回值(socket / epoll / select 等非阻塞接口):成功 → 值;false → 需等待(非错误);nil, errmsg → 失败/对端关闭。参数校验错误才 error()。
  • 句柄类对象用 to-be-closed 管理:local fd <close> = assert(socket.create "tcp")。
  • 子进程管道是标准 file*,用 :read "a" / :write / :close。
  • 线程/通道传值经 bee.serialization,只支持 nil/boolean/number/string/table/light C function。
  • 平台上不可用的模块/接口在测试中跳过(test/test_skip.lua、test/supported.lua)。

可选链(编译期 patch)

?. / ?: / ?[...] / f?(...) 是 vendored Lua 的补丁语法,仅当 luamake -optchain 构建时可用(补丁机制见 AGENT.md):

  • 只有 nil 短路,false 会照常报错;短路时参数/键不会被求值,接收者只求值一次。
  • 短路只覆盖链本身:(nothing?.b).c、nothing?.b + 1 仍报错。
  • 不可作为赋值目标。
  • 完整行为(含字节码布局)见 test/test_optional_chain.lua。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Report a problem with this skill