aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/lobject.h b/lobject.h
index 447b3622..215ab4a8 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.92 2001/02/01 17:40:48 roberto Exp roberto $ 2** $Id: lobject.h,v 1.93 2001/02/02 15:13:05 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*/
@@ -36,7 +36,10 @@
36 36
37 37
38typedef union { 38typedef union {
39 void *v; 39 struct TString *ts;
40 struct Closure *cl;
41 struct Hash *h;
42 struct CallInfo *info;
40 lua_Number n; /* LUA_TNUMBER */ 43 lua_Number n; /* LUA_TNUMBER */
41} Value; 44} Value;
42 45
@@ -50,10 +53,10 @@ typedef struct lua_TObject {
50/* Macros to access values */ 53/* Macros to access values */
51#define ttype(o) ((o)->tt) 54#define ttype(o) ((o)->tt)
52#define nvalue(o) ((o)->value.n) 55#define nvalue(o) ((o)->value.n)
53#define tsvalue(o) ((struct TString *)(o)->value.v) 56#define tsvalue(o) ((o)->value.ts)
54#define clvalue(o) ((struct Closure *)(o)->value.v) 57#define clvalue(o) ((o)->value.cl)
55#define hvalue(o) ((struct Hash *)(o)->value.v) 58#define hvalue(o) ((o)->value.h)
56#define infovalue(o) ((struct CallInfo *)(o)->value.v) 59#define infovalue(o) ((o)->value.info)
57#define svalue(o) (tsvalue(o)->str) 60#define svalue(o) (tsvalue(o)->str)
58 61
59 62
@@ -62,24 +65,19 @@ typedef struct lua_TObject {
62 { TObject *_o=(obj); _o->tt=LUA_TNUMBER; _o->value.n=(x); } 65 { TObject *_o=(obj); _o->tt=LUA_TNUMBER; _o->value.n=(x); }
63 66
64#define setsvalue(obj,x) \ 67#define setsvalue(obj,x) \
65 { TObject *_o=(obj); struct TString *_v=(x); \ 68 { TObject *_o=(obj); _o->tt=LUA_TSTRING; _o->value.ts=(x); }
66 _o->tt=LUA_TSTRING; _o->value.v=_v; }
67 69
68#define setuvalue(obj,x) \ 70#define setuvalue(obj,x) \
69 { TObject *_o=(obj); struct TString *_v=(x); \ 71 { TObject *_o=(obj); _o->tt=LUA_TUSERDATA; _o->value.ts=(x); }
70 _o->tt=LUA_TUSERDATA; _o->value.v=_v; }
71 72
72#define setclvalue(obj,x) \ 73#define setclvalue(obj,x) \
73 { TObject *_o=(obj); struct Closure *_v=(x); \ 74 { TObject *_o=(obj); _o->tt=LUA_TFUNCTION; _o->value.cl=(x); }
74 _o->tt=LUA_TFUNCTION; _o->value.v=_v; }
75 75
76#define sethvalue(obj,x) \ 76#define sethvalue(obj,x) \
77 { TObject *_o=(obj); struct Hash *_v=(x); \ 77 { TObject *_o=(obj); _o->tt=LUA_TTABLE; _o->value.h=(x); }
78 _o->tt=LUA_TTABLE; _o->value.v=_v; }
79 78
80#define setivalue(obj,x) \ 79#define setivalue(obj,x) \
81 { TObject *_o=(obj); struct CallInfo *_v=(x); \ 80 { TObject *_o=(obj); _o->tt=LUA_TMARK; _o->value.info=(x); }
82 _o->tt=LUA_TMARK; _o->value.v=_v; }
83 81
84#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) 82#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
85 83