Files
LuaCangjia_api/doc/ADAPTATION-lua11.md
JianFeeeee 845a8780c0 vendor: 引入 Lua 1.1 官方源码 + 移植评估 (lua_1.1 分支)
- 1994 年发布, 全局单例状态机+按名调用+无虚拟栈模型
- 评估结论: 不建议移植, 详见 doc/ADAPTATION-lua11.md
- 建议历史脚本用 5.1 兼容模式运行替代
2026-08-25 10:21:47 +08:00

34 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Lua 1.1 分支移植评估ADAPTATION.md
> 本分支已 vendor Lua 1.1 官方源码到 `lib/lua/`src/ + include/1994 年发布)。
> **桥接层尚未适配,且不建议移植。**
## 结论:不建议移植
Lua 1.1 是 Lua 的第二个公开版本1994API 极简且与现代 Lua 完全割裂:
```c
/* lua.h 全部嵌入 API共约 20 个) */
int lua_dofile(char *filename);
int lua_dostring(char *string);
int lua_call(char *functionname, int nparam); /* 按函数名调用 */
```
不可移植的根本原因:
1. **全局单例状态机** —— 无任何状态句柄,多 runner 实例不可能
2. **无虚拟栈模型** —— 参数经 `lua_getparam(int)` 获取、返回值用 `lua_pushobject`
隐式对象接口;本项目的 pkgs[] 管道栈布局完全无处安放
3. **按名调用** —— `lua_call("funcname", n)`,没有函数值概念,
loadFunction/callFunction 预加载模式无法对应
4. 词法分析器依赖 yacc/lex 工具链构建src/yacc/),现代环境需额外工具
5. 1994 年 K&R C 代码GCC 现代默认标准下大量编译错误
## 替代建议
如需运行 Lua 1.x 历史脚本:
- 多数语法是 Lua 5.1 的子集,可直接用 lua_5.1.5 分支尝试加载
- 或使用官方 lua-5.1 的 LUA_COMPAT 特性
本分支仅作为源码存档。