aboutsummaryrefslogtreecommitdiff
path: root/src/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat.h')
-rw-r--r--src/compat.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/compat.h b/src/compat.h
index 8ef1b6c..8d10e78 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -98,3 +98,30 @@ int lua_setiuservalue( lua_State* L, int idx, int n);
98#define LUA_ERRGCMM 666 // doesn't exist in Lua 5.4, we don't care about the actual value 98#define LUA_ERRGCMM 666 // doesn't exist in Lua 5.4, we don't care about the actual value
99 99
100#endif // LUA_VERSION_NUM == 504 100#endif // LUA_VERSION_NUM == 504
101
102// #################################################################################################
103
104// a wrapper over lua types to see them easier in a debugger
105enum class LuaType
106{
107 NONE = LUA_TNONE,
108 NIL = LUA_TNIL,
109 BOOLEAN = LUA_TBOOLEAN,
110 LIGHTUSERDATA = LUA_TLIGHTUSERDATA,
111 NUMBER = LUA_TNUMBER,
112 STRING = LUA_TSTRING,
113 TABLE = LUA_TTABLE,
114 FUNCTION = LUA_TFUNCTION,
115 USERDATA = LUA_TUSERDATA,
116 THREAD = LUA_TTHREAD,
117 CDATA = 10 // LuaJIT CDATA
118};
119
120inline LuaType lua_type_as_enum(lua_State* L, int idx_)
121{
122 return static_cast<LuaType>(lua_type(L, idx_));
123}
124inline char const* lua_typename(lua_State* L, LuaType t_)
125{
126 return lua_typename(L, static_cast<int>(t_));
127}