aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lobject.h b/lobject.h
index bf07e3db..9d197af2 100644
--- a/lobject.h
+++ b/lobject.h
@@ -37,7 +37,8 @@ typedef union {
37 union Closure *cl; 37 union Closure *cl;
38 struct Table *h; 38 struct Table *h;
39 struct lua_TObject *v; 39 struct lua_TObject *v;
40 lua_Number n; /* LUA_TNUMBER */ 40 lua_Number n;
41 int b;
41} Value; 42} Value;
42 43
43 44
@@ -55,7 +56,10 @@ typedef struct lua_TObject {
55#define clvalue(o) ((o)->value.cl) 56#define clvalue(o) ((o)->value.cl)
56#define hvalue(o) ((o)->value.h) 57#define hvalue(o) ((o)->value.h)
57#define vvalue(o) ((o)->value.v) 58#define vvalue(o) ((o)->value.v)
59#define bvalue(o) ((o)->value.b)
58 60
61#define l_isfalse(o) (ttype(o) == LUA_TNIL || \
62 (ttype(o) == LUA_TBOOLEAN && bvalue(o) == 0))
59 63
60/* Macros to set values */ 64/* Macros to set values */
61#define setnvalue(obj,x) \ 65#define setnvalue(obj,x) \
@@ -63,6 +67,9 @@ typedef struct lua_TObject {
63 67
64#define chgnvalue(obj,x) ((obj)->value.n=(x)) 68#define chgnvalue(obj,x) ((obj)->value.n=(x))
65 69
70#define setbvalue(obj,x) \
71 { TObject *_o=(obj); _o->tt=LUA_TBOOLEAN; _o->value.b=(x); }
72
66#define setsvalue(obj,x) \ 73#define setsvalue(obj,x) \
67 { TObject *_o=(obj); _o->tt=LUA_TSTRING; _o->value.ts=(x); } 74 { TObject *_o=(obj); _o->tt=LUA_TSTRING; _o->value.ts=(x); }
68 75