--- title: thread - 协程 summary: Lua thread 是协程,并非操作系统线程。请确认 X4 界面环境是否提供并允许使用协程。协程不允许你从其他操作系统线程调用引擎。 section: reference kind: guide status: reference updated: 2026-10-26 tags: ["API","X4"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/","https://www.lua.org/manual/5.1/manual.html","https://luajit.org/ext_ffi_api.html"] --- ## 含义 Lua thread 是协程,并非操作系统线程。请确认 X4 界面环境是否提供并允许使用协程。协程不允许你从其他操作系统线程调用引擎。 ## 示例 ```lua local function describe(value) return type(value) end ``` **运行效果:** 只有描述才被声明;这个碎片不会产生一个 coroutine. 这段段没有打印或写日志信息. 显示的值是示例的预期结果. ## 方法与相关调用 [API 参考](wiki:api-index).