mirror of
https://gitcode.com/JianFeeeee/LuaCangjia_api.git
synced 2026-09-20 08:58:13 +00:00
docs: 更新 Lua 4.0 移植评估 + compat_40.h 骨架
- 明确支持范围: doString/runScript(单次)/loadFunction/callFunction/IO重定向/typed - 明确不可实现: 管道模式与 load_lib 压栈(4.0 无 luaL_loadfile) - 关键 API 映射表(lua_call 即保护调用/lua_ref 替代 Registry/ pushboolean→pushnumber/_ERRORMESSAGE 全局取错误) - compat_40.h 骨架: 版本宏 LUA_VERSION_NUM=400 与 LUA_OK 定义
This commit is contained in:
22
lib/lua/compat_40.h
Normal file
22
lib/lua/compat_40.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef COMPAT_40_H
|
||||
#define COMPAT_40_H
|
||||
/* Lua 4.0.x 兼容层。
|
||||
支持范围: callFunction / doString / runScript(单脚本) / I/O 重定向。
|
||||
不支持: 管道模式(4.0 无 load+call 分离 API, luaL_loadfile 是 5.0 新增)。
|
||||
|
||||
关键差异与映射:
|
||||
- lua_call(L,n,r) 在 4.0 即为保护调用(返回 status), 等价 5.x 的 lua_pcall
|
||||
- 无 LUA_REGISTRYINDEX: 用 lua_ref(L,1) 锁定栈顶值, lua_getref 取回
|
||||
- 无 lua_pushboolean: boolean 用 number 0/1 表示(4.0 无 boolean 类型)
|
||||
- 无 luaL_loadfile/loadbuffer: 无法分离编译与执行 → 管道不可实现
|
||||
*/
|
||||
|
||||
/* ---- 版本宏 ---- */
|
||||
#define LUA_VERSION_NUM 400
|
||||
|
||||
/* ---- 成功码 ---- */
|
||||
#ifndef LUA_OK
|
||||
#define LUA_OK 0
|
||||
#endif
|
||||
|
||||
#endif /* COMPAT_40_H */
|
||||
Reference in New Issue
Block a user