diff options
Diffstat (limited to 'src/compat.h')
-rw-r--r-- | src/compat.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compat.h b/src/compat.h index 4816cb7..f98e142 100644 --- a/src/compat.h +++ b/src/compat.h | |||
@@ -100,6 +100,25 @@ inline int lua504_dump(lua_State* L_, lua_Writer writer_, void* data_, [[maybe_u | |||
100 | 100 | ||
101 | // ################################################################################################# | 101 | // ################################################################################################# |
102 | 102 | ||
103 | #if LUA_VERSION_NUM < 503 | ||
104 | // starting with Lua 5.3, lua_getfield returns the type of the value it found | ||
105 | inline int lua503_getfield(lua_State* L_, int idx_, char const* k_) | ||
106 | { | ||
107 | lua_getfield(L_, idx_, k_); | ||
108 | return lua_type(L_, -1); | ||
109 | } | ||
110 | |||
111 | #else // LUA_VERSION_NUM >= 503 | ||
112 | |||
113 | inline int lua503_getfield(lua_State* L_, int idx_, char const* k_) | ||
114 | { | ||
115 | return lua_getfield(L_, idx_, k_); | ||
116 | } | ||
117 | |||
118 | #endif // LUA_VERSION_NUM >= 503 | ||
119 | |||
120 | // ################################################################################################# | ||
121 | |||
103 | // wrap Lua 5.3 calls under Lua 5.1 API when it is simpler that way | 122 | // wrap Lua 5.3 calls under Lua 5.1 API when it is simpler that way |
104 | #if LUA_VERSION_NUM == 503 | 123 | #if LUA_VERSION_NUM == 503 |
105 | 124 | ||
@@ -199,3 +218,5 @@ inline char const* lua_typename(lua_State* L_, LuaType t_) | |||
199 | { | 218 | { |
200 | return lua_typename(L_, static_cast<int>(t_)); | 219 | return lua_typename(L_, static_cast<int>(t_)); |
201 | } | 220 | } |
221 | |||
222 | int luaG_getpackage(lua_State* L_); | ||