示例工程 19-modules-and-env
19-modules-and-env/03-env-sandbox/README.md
# 03 · env-sandbox
**演示**:`load(..., "t", env)` 只暴露 `math`;访问 `os` 失败。
**运行时**:`lua54`、`luajit`。
**运行**:
```sh
.tools/bin/lua54 scripts/run-example.lua examples/19-modules-and-env/03-env-sandbox
.tools/bin/lua54 scripts/test-example.lua examples/19-modules-and-env/03-env-sandbox
```
**预期输出**(lua 5.4.9 / macOS arm64):
```text
result=2 blocked=true
```
**看点**:`_ENV` 是普通变量,可以整体替换。
**注意**:沙箱必须移除 `debug`/`package`/`io` 才可能安全。