--- title: boolean - 布尔值 summary: true 和 false 两个值。在 Lua 条件中,只有 false 和 nil 被视为假。数字 0、空字符串和空表都被视为真。请核对具体 API 的约定。 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"] --- ## 含义 true 和 false 两个值。在 Lua 条件中,只有 false 和 nil 被视为假。数字 0、空字符串和空表都被视为真。请核对具体 API 的约定。 ## 示例 ```lua local ready = false if not ready then ready = true end ``` **运行效果:** 准备就会变得真实,因为没有假的都是真实的. 这段段没有打印或写日志信息. 显示的值是示例的预期结果. ## 方法与相关调用 [API 参考](wiki:api-index).