diff options
-rw-r--r-- | lobject.h | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.52 2011/05/05 15:53:23 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.53 2011/05/05 19:43:14 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -114,18 +114,19 @@ typedef struct lua_TValue { | |||
114 | 114 | ||
115 | 115 | ||
116 | /* Macros to test type */ | 116 | /* Macros to test type */ |
117 | #define ttisnumber(o) (rttype(o) == LUA_TNUMBER) | 117 | #define checktag(o,t) (rttype(o) == (t)) |
118 | #define ttisnil(o) (rttype(o) == LUA_TNIL) | 118 | #define ttisnumber(o) checktag((o), LUA_TNUMBER) |
119 | #define ttisboolean(o) (rttype(o) == LUA_TBOOLEAN) | 119 | #define ttisnil(o) checktag((o), LUA_TNIL) |
120 | #define ttislightuserdata(o) (rttype(o) == LUA_TLIGHTUSERDATA) | 120 | #define ttisboolean(o) checktag((o), LUA_TBOOLEAN) |
121 | #define ttisstring(o) (rttype(o) == ctb(LUA_TSTRING)) | 121 | #define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) |
122 | #define ttistable(o) (rttype(o) == ctb(LUA_TTABLE)) | 122 | #define ttisstring(o) checktag((o), ctb(LUA_TSTRING)) |
123 | #define ttistable(o) checktag((o), ctb(LUA_TTABLE)) | ||
123 | #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) | 124 | #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) |
124 | #define ttisclosure(o) (rttype(o) == ctb(LUA_TFUNCTION)) | 125 | #define ttisclosure(o) checktag((o), ctb(LUA_TFUNCTION)) |
125 | #define ttislcf(o) (rttype(o) == LUA_TLCF) | 126 | #define ttislcf(o) checktag((o), LUA_TLCF) |
126 | #define ttisuserdata(o) (rttype(o) == ctb(LUA_TUSERDATA)) | 127 | #define ttisuserdata(o) checktag((o), ctb(LUA_TUSERDATA)) |
127 | #define ttisthread(o) (rttype(o) == ctb(LUA_TTHREAD)) | 128 | #define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) |
128 | #define ttisdeadkey(o) (rttype(o) == ctb(LUA_TDEADKEY)) | 129 | #define ttisdeadkey(o) checktag((o), ctb(LUA_TDEADKEY)) |
129 | 130 | ||
130 | #define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) | 131 | #define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) |
131 | 132 | ||