Files
LuaCangjia_api/lib/lua/ltable.h
JianFeeeee c23f8c5e32 feat: 适配 Lua 5.1.5 (lua_5.1.5 分支)
- lib/lua 替换为 Lua 5.1.5 官方源码; CMakeLists 删除 5.1 不存在的
  lcorolib.c/lctype.c/lutf8lib.c/lbitlib.c
- 补充 lua.hpp C++ 包装头(5.1 官方不提供, 保持桥接 include 路径不变)
- LUA_OK 兼容宏: 5.1 无此定义(成功返回值为 0)
- luaL_tolstring 兼容: 5.1 无此 API, l_print 改用 lua_tostring +
  lua_typename 兜底(#if LUA_VERSION_NUM >= 502 条件编译, 弹栈逻辑同步分支)
- luaL_setfuncs 兼容: 5.1 无此 API, push_tty_file 改手动循环注册
- I/O 重定向沿用 Registry 方案(自 5.2.4 分支同步), typed interop
  版本自适应断言同步
- 验证: GTest 44/44 通过
2026-08-25 11:13:41 +08:00

41 lines
1.2 KiB
C

/*
** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
#ifndef ltable_h
#define ltable_h
#include "lobject.h"
#define gnode(t,i) (&(t)->node[i])
#define gkey(n) (&(n)->i_key.nk)
#define gval(n) (&(n)->i_val)
#define gnext(n) ((n)->i_key.nk.next)
#define key2tval(n) (&(n)->i_key.tvk)
LUAI_FUNC const TValue *luaH_getnum (Table *t, int key);
LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key);
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash);
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
LUAI_FUNC int luaH_getn (Table *t);
#if defined(LUA_DEBUG)
LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
LUAI_FUNC int luaH_isdummy (Node *n);
#endif
#endif