示例工程 28-release-and-compat

28-release-and-compat/02-feature-detection/README.md

markdown · 0.6 KB

# 02 · feature-detection
 
**演示**:检测 `math.type`/`utf8`/`table.pack`/`goto`,不依赖 `_VERSION`。
**运行时**:`lua54`、`luajit`。
**运行**:
 
```sh
.tools/bin/lua54 scripts/run-example.lua examples/28-release-and-compat/02-feature-detection
.tools/bin/lua54 scripts/test-example.lua examples/28-release-and-compat/02-feature-detection
```
 
**预期输出**(lua 5.4.9 / macOS arm64):
 
```text
integer=true utf8=true pack=true goto=true
```
 
**看点**:LuaJIT 自报 5.1,却支持 `goto`;版本不能推断能力。
**注意**:`load` 只编译不执行,适合检测语法特性。