diff options
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -44,7 +44,6 @@ | |||
44 | typedef union Value { | 44 | typedef union Value { |
45 | struct GCObject *gc; /* collectable objects */ | 45 | struct GCObject *gc; /* collectable objects */ |
46 | void *p; /* light userdata */ | 46 | void *p; /* light userdata */ |
47 | int b; /* booleans */ | ||
48 | lua_CFunction f; /* light C functions */ | 47 | lua_CFunction f; /* light C functions */ |
49 | lua_Integer i; /* integer numbers */ | 48 | lua_Integer i; /* integer numbers */ |
50 | lua_Number n; /* float numbers */ | 49 | lua_Number n; /* float numbers */ |
@@ -210,16 +209,20 @@ typedef StackValue *StkId; | |||
210 | ** =================================================================== | 209 | ** =================================================================== |
211 | */ | 210 | */ |
212 | 211 | ||
213 | #define ttisboolean(o) checktag((o), LUA_TBOOLEAN) | ||
214 | 212 | ||
215 | #define bvalue(o) check_exp(ttisboolean(o), val_(o).b) | 213 | #define LUA_TFALSE (LUA_TBOOLEAN | (1 << 4)) |
214 | #define LUA_TTRUE (LUA_TBOOLEAN | (2 << 4)) | ||
216 | 215 | ||
217 | #define bvalueraw(v) ((v).b) | 216 | #define ttisboolean(o) checktype((o), LUA_TBOOLEAN) |
217 | #define ttisfalse(o) checktag((o), LUA_TFALSE) | ||
218 | #define ttistrue(o) checktag((o), LUA_TTRUE) | ||
218 | 219 | ||
219 | #define l_isfalse(o) (ttisboolean(o) ? bvalue(o) == 0 : ttisnil(o)) | ||
220 | 220 | ||
221 | #define setbvalue(obj,x) \ | 221 | #define l_isfalse(o) (ttisfalse(o) || ttisnil(o)) |
222 | { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } | 222 | |
223 | |||
224 | #define setbfvalue(obj) settt_(obj, LUA_TFALSE) | ||
225 | #define setbtvalue(obj) settt_(obj, LUA_TTRUE) | ||
223 | 226 | ||
224 | /* }================================================================== */ | 227 | /* }================================================================== */ |
225 | 228 | ||