示例工程 30-embedding-and-cpp
30-embedding-and-cpp/03-sol2-minimal/README.md
# 03 · sol2-minimal
**演示**:用 Lua 表模拟 sol2 暴露的 `Point` 工厂与成员方法。
**运行时**:`lua54`、`luajit`(模拟)。
**运行**:
```sh
.tools/bin/lua54 scripts/run-example.lua examples/30-embedding-and-cpp/03-sol2-minimal
.tools/bin/lua54 scripts/test-example.lua examples/30-embedding-and-cpp/03-sol2-minimal
```
**预期输出**(lua 5.4.9 / macOS arm64):
```text
x=3 y=4 length=5
```
**看点**:绑定层把 C++ 类型映射成 userdata/表,方法名与生命周期由绑定决定。
**注意**:🖐 真实 sol2 需 C++ 编译与 vendor 头文件;本示例只展示形态。