aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-17 13:25:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-17 13:25:13 -0300
commit79c8edb6c423b48270c1f61df6fd5a889ca5da0e (patch)
tree1b79c096472f5f799f5576561e831b0d992c8cd0
parente5146fb01f1ccb40c2663e745feffbf642cbf862 (diff)
downloadlua-79c8edb6c423b48270c1f61df6fd5a889ca5da0e.tar.gz
lua-79c8edb6c423b48270c1f61df6fd5a889ca5da0e.tar.bz2
lua-79c8edb6c423b48270c1f61df6fd5a889ca5da0e.zip
new names for light userdata operations
-rw-r--r--lapi.c9
-rw-r--r--lbaselib.c10
-rw-r--r--ldblib.c8
-rw-r--r--lgc.c4
-rw-r--r--liolib.c4
-rw-r--r--lobject.c4
-rw-r--r--lobject.h6
-rw-r--r--ltable.c4
-rw-r--r--ltests.c9
-rw-r--r--ltests.h7
-rw-r--r--ltm.c4
-rw-r--r--lua.h18
-rw-r--r--lvm.c4
13 files changed, 47 insertions, 44 deletions
diff --git a/lapi.c b/lapi.c
index 67fe9ddc..ebb16a38 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.203 2002/06/25 19:15:41 roberto Exp roberto $ 2** $Id: lapi.c,v 1.204 2002/06/26 19:28:44 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -305,7 +305,7 @@ LUA_API void *lua_touserdata (lua_State *L, int index) {
305 if (o == NULL) return NULL; 305 if (o == NULL) return NULL;
306 switch (ttype(o)) { 306 switch (ttype(o)) {
307 case LUA_TUSERDATA: return (uvalue(o) + 1); 307 case LUA_TUSERDATA: return (uvalue(o) + 1);
308 case LUA_TUDATAVAL: return pvalue(o); 308 case LUA_TLIGHTUSERDATA: return pvalue(o);
309 default: return NULL; 309 default: return NULL;
310 } 310 }
311} 311}
@@ -318,6 +318,9 @@ LUA_API const void *lua_topointer (lua_State *L, int index) {
318 switch (ttype(o)) { 318 switch (ttype(o)) {
319 case LUA_TTABLE: return hvalue(o); 319 case LUA_TTABLE: return hvalue(o);
320 case LUA_TFUNCTION: return clvalue(o); 320 case LUA_TFUNCTION: return clvalue(o);
321 case LUA_TUSERDATA:
322 case LUA_TLIGHTUSERDATA:
323 return lua_touserdata(L, index);
321 default: return NULL; 324 default: return NULL;
322 } 325 }
323 } 326 }
@@ -407,7 +410,7 @@ LUA_API void lua_pushboolean (lua_State *L, int b) {
407} 410}
408 411
409 412
410LUA_API void lua_pushudataval (lua_State *L, void *p) { 413LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
411 lua_lock(L); 414 lua_lock(L);
412 setpvalue(L->top, p); 415 setpvalue(L->top, p);
413 api_incr_top(L); 416 api_incr_top(L);
diff --git a/lbaselib.c b/lbaselib.c
index 3edd8050..39f1544e 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.89 2002/07/01 19:23:58 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.90 2002/07/04 17:58:02 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -310,7 +310,7 @@ static int luaB_tostring (lua_State *L) {
310 sprintf(buff, "function: %p", lua_topointer(L, 1)); 310 sprintf(buff, "function: %p", lua_topointer(L, 1));
311 break; 311 break;
312 case LUA_TUSERDATA: 312 case LUA_TUSERDATA:
313 case LUA_TUDATAVAL: 313 case LUA_TLIGHTUSERDATA:
314 sprintf(buff, "userdata: %p", lua_touserdata(L, 1)); 314 sprintf(buff, "userdata: %p", lua_touserdata(L, 1));
315 break; 315 break;
316 case LUA_TNIL: 316 case LUA_TNIL:
@@ -484,7 +484,7 @@ static const luaL_reg base_funcs[] = {
484 484
485 485
486static int luaB_resume (lua_State *L) { 486static int luaB_resume (lua_State *L) {
487 lua_State *co = (lua_State *)lua_getfrombox(L, lua_upvalueindex(1)); 487 lua_State *co = (lua_State *)lua_unboxpointer(L, lua_upvalueindex(1));
488 int status; 488 int status;
489 lua_settop(L, 0); 489 lua_settop(L, 0);
490 status = lua_resume(L, co); 490 status = lua_resume(L, co);
@@ -503,7 +503,7 @@ static int luaB_resume (lua_State *L) {
503 503
504 504
505static int gc_coroutine (lua_State *L) { 505static int gc_coroutine (lua_State *L) {
506 lua_State *co = (lua_State *)lua_getfrombox(L, 1); 506 lua_State *co = (lua_State *)lua_unboxpointer(L, 1);
507 lua_closethread(L, co); 507 lua_closethread(L, co);
508 return 0; 508 return 0;
509} 509}
@@ -526,7 +526,7 @@ static int luaB_coroutine (lua_State *L) {
526 lua_unref(L, ref); 526 lua_unref(L, ref);
527 } 527 }
528 lua_cobegin(NL, n-1); 528 lua_cobegin(NL, n-1);
529 lua_newpointerbox(L, NL); 529 lua_boxpointer(L, NL);
530 lua_pushliteral(L, "Coroutine"); 530 lua_pushliteral(L, "Coroutine");
531 lua_rawget(L, LUA_REGISTRYINDEX); 531 lua_rawget(L, LUA_REGISTRYINDEX);
532 lua_setmetatable(L, -2); 532 lua_setmetatable(L, -2);
diff --git a/ldblib.c b/ldblib.c
index fc056cce..13e328d3 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.62 2002/07/08 18:21:33 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.63 2002/07/08 20:22:08 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -113,7 +113,7 @@ static const char KEY_HOOK = 'h';
113 113
114static void hookf (lua_State *L, lua_Debug *ar) { 114static void hookf (lua_State *L, lua_Debug *ar) {
115 static const char *const hooknames[] = {"call", "return", "line", "count"}; 115 static const char *const hooknames[] = {"call", "return", "line", "count"};
116 lua_pushudataval(L, (void *)&KEY_HOOK); 116 lua_pushlightuserdata(L, (void *)&KEY_HOOK);
117 lua_rawget(L, LUA_REGISTRYINDEX); 117 lua_rawget(L, LUA_REGISTRYINDEX);
118 if (lua_isfunction(L, -1)) { 118 if (lua_isfunction(L, -1)) {
119 lua_pushstring(L, hooknames[(int)ar->event]); 119 lua_pushstring(L, hooknames[(int)ar->event]);
@@ -157,7 +157,7 @@ static int sethook (lua_State *L) {
157 luaL_check_type(L, 1, LUA_TFUNCTION); 157 luaL_check_type(L, 1, LUA_TFUNCTION);
158 lua_sethook(L, hookf, makemask(smask, count)); 158 lua_sethook(L, hookf, makemask(smask, count));
159 } 159 }
160 lua_pushudataval(L, (void *)&KEY_HOOK); 160 lua_pushlightuserdata(L, (void *)&KEY_HOOK);
161 lua_pushvalue(L, 1); 161 lua_pushvalue(L, 1);
162 lua_rawset(L, LUA_REGISTRYINDEX); /* set new hook */ 162 lua_rawset(L, LUA_REGISTRYINDEX); /* set new hook */
163 return 0; 163 return 0;
@@ -167,7 +167,7 @@ static int sethook (lua_State *L) {
167static int gethook (lua_State *L) { 167static int gethook (lua_State *L) {
168 char buff[5]; 168 char buff[5];
169 int mask = lua_gethookmask(L); 169 int mask = lua_gethookmask(L);
170 lua_pushudataval(L, (void *)&KEY_HOOK); 170 lua_pushlightuserdata(L, (void *)&KEY_HOOK);
171 lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ 171 lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */
172 lua_pushstring(L, unmakemask(mask, buff)); 172 lua_pushstring(L, unmakemask(mask, buff));
173 lua_pushnumber(L, lua_getmaskcount(mask)); 173 lua_pushnumber(L, lua_getmaskcount(mask));
diff --git a/lgc.c b/lgc.c
index 991ff51d..47513769 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.141 2002/07/04 17:57:42 roberto Exp $ 2** $Id: lgc.c,v 1.142 2002/07/08 18:21:33 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -58,7 +58,7 @@ typedef struct GCState {
58 58
59#define ismarkable(o) (!((1 << ttype(o)) & \ 59#define ismarkable(o) (!((1 << ttype(o)) & \
60 ((1 << LUA_TNIL) | (1 << LUA_TNUMBER) | \ 60 ((1 << LUA_TNIL) | (1 << LUA_TNUMBER) | \
61 (1 << LUA_TBOOLEAN) | (1 << LUA_TUDATAVAL)))) 61 (1 << LUA_TBOOLEAN) | (1 << LUA_TLIGHTUSERDATA))))
62 62
63static void reallymarkobject (GCState *st, TObject *o); 63static void reallymarkobject (GCState *st, TObject *o);
64 64
diff --git a/liolib.c b/liolib.c
index e67d61fd..2798e2bf 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.12 2002/06/26 16:37:13 roberto Exp roberto $ 2** $Id: liolib.c,v 2.13 2002/07/12 18:54:53 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -67,7 +67,7 @@ static FILE *tofile (lua_State *L, int findex) {
67 67
68 68
69static void newfile (lua_State *L, FILE *f) { 69static void newfile (lua_State *L, FILE *f) {
70 lua_newpointerbox(L, f); 70 lua_boxpointer(L, f);
71 lua_pushliteral(L, FILEHANDLE); 71 lua_pushliteral(L, FILEHANDLE);
72 lua_rawget(L, LUA_REGISTRYINDEX); 72 lua_rawget(L, LUA_REGISTRYINDEX);
73 lua_setmetatable(L, -2); 73 lua_setmetatable(L, -2);
diff --git a/lobject.c b/lobject.c
index 86d386df..d2605ebd 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.83 2002/06/05 12:34:19 roberto Exp roberto $ 2** $Id: lobject.c,v 1.84 2002/06/13 13:39:55 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -66,7 +66,7 @@ int luaO_rawequalObj (const TObject *t1, const TObject *t2) {
66 return tsvalue(t1) == tsvalue(t2); 66 return tsvalue(t1) == tsvalue(t2);
67 case LUA_TBOOLEAN: 67 case LUA_TBOOLEAN:
68 return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ 68 return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
69 case LUA_TUDATAVAL: 69 case LUA_TLIGHTUSERDATA:
70 return pvalue(t1) == pvalue(t2); 70 return pvalue(t1) == pvalue(t2);
71 case LUA_TUSERDATA: 71 case LUA_TUSERDATA:
72 return uvalue(t1) == uvalue(t2); 72 return uvalue(t1) == uvalue(t2);
diff --git a/lobject.h b/lobject.h
index 616b897c..0e800c16 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.138 2002/06/24 20:17:59 roberto Exp roberto $ 2** $Id: lobject.h,v 1.139 2002/07/01 17:06:58 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*/
@@ -35,7 +35,7 @@ typedef struct lua_TObject {
35 35
36/* Macros to access values */ 36/* Macros to access values */
37#define ttype(o) ((o)->tt) 37#define ttype(o) ((o)->tt)
38#define pvalue(o) check_exp(ttype(o)==LUA_TUDATAVAL, (o)->value.p) 38#define pvalue(o) check_exp(ttype(o)==LUA_TLIGHTUSERDATA, (o)->value.p)
39#define nvalue(o) check_exp(ttype(o)==LUA_TNUMBER, (o)->value.n) 39#define nvalue(o) check_exp(ttype(o)==LUA_TNUMBER, (o)->value.n)
40#define tsvalue(o) check_exp(ttype(o)==LUA_TSTRING, (o)->value.ts) 40#define tsvalue(o) check_exp(ttype(o)==LUA_TSTRING, (o)->value.ts)
41#define uvalue(o) check_exp(ttype(o)==LUA_TUSERDATA, (o)->value.u) 41#define uvalue(o) check_exp(ttype(o)==LUA_TUSERDATA, (o)->value.u)
@@ -54,7 +54,7 @@ typedef struct lua_TObject {
54 check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x)) 54 check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
55 55
56#define setpvalue(obj,x) \ 56#define setpvalue(obj,x) \
57 { TObject *i_o=(obj); i_o->tt=LUA_TUDATAVAL; i_o->value.p=(x); } 57 { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); }
58 58
59#define setbvalue(obj,x) \ 59#define setbvalue(obj,x) \
60 { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); } 60 { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); }
diff --git a/ltable.c b/ltable.c
index baab5ea3..2951def0 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.112 2002/07/01 19:31:10 roberto Exp roberto $ 2** $Id: ltable.c,v 1.113 2002/07/02 17:54:23 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -80,7 +80,7 @@ Node *luaH_mainposition (const Table *t, const TObject *key) {
80 return hashstr(t, tsvalue(key)); 80 return hashstr(t, tsvalue(key));
81 case LUA_TBOOLEAN: 81 case LUA_TBOOLEAN:
82 return hashboolean(t, bvalue(key)); 82 return hashboolean(t, bvalue(key));
83 case LUA_TUDATAVAL: 83 case LUA_TLIGHTUSERDATA:
84 return hashpointer(t, pvalue(key)); 84 return hashpointer(t, pvalue(key));
85 case LUA_TUSERDATA: 85 case LUA_TUSERDATA:
86 return hashpointer(t, uvalue(key)); 86 return hashpointer(t, uvalue(key));
diff --git a/ltests.c b/ltests.c
index 99623541..4dee632c 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.128 2002/06/25 19:16:44 roberto Exp roberto $ 2** $Id: ltests.c,v 1.129 2002/07/09 14:58:28 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -413,7 +413,7 @@ static int newuserdata (lua_State *L) {
413 413
414 414
415static int pushuserdata (lua_State *L) { 415static int pushuserdata (lua_State *L) {
416 lua_pushudataval(L, cast(void *, luaL_check_int(L, 1))); 416 lua_pushlightuserdata(L, cast(void *, luaL_check_int(L, 1)));
417 return 1; 417 return 1;
418} 418}
419 419
@@ -579,7 +579,7 @@ static int testC (lua_State *L) {
579 lua_pushnumber(L, lua_isuserdata(L, getnum)); 579 lua_pushnumber(L, lua_isuserdata(L, getnum));
580 } 580 }
581 else if EQ("isudataval") { 581 else if EQ("isudataval") {
582 lua_pushnumber(L, lua_isudataval(L, getnum)); 582 lua_pushnumber(L, lua_islightuserdata(L, getnum));
583 } 583 }
584 else if EQ("isnil") { 584 else if EQ("isnil") {
585 lua_pushnumber(L, lua_isnil(L, getnum)); 585 lua_pushnumber(L, lua_isnil(L, getnum));
@@ -741,11 +741,12 @@ static void fim (void) {
741} 741}
742 742
743 743
744void luaB_opentests (lua_State *L) { 744int luaB_opentests (lua_State *L) {
745 *cast(int **, L) = &islocked; /* init lock */ 745 *cast(int **, L) = &islocked; /* init lock */
746 lua_state = L; /* keep first state to be opened */ 746 lua_state = L; /* keep first state to be opened */
747 luaL_opennamedlib(L, "T", tests_funcs, 0); 747 luaL_opennamedlib(L, "T", tests_funcs, 0);
748 atexit(fim); 748 atexit(fim);
749 return 0;
749} 750}
750 751
751#endif 752#endif
diff --git a/ltests.h b/ltests.h
index 9a03d27a..821ce07c 100644
--- a/ltests.h
+++ b/ltests.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.h,v 1.13 2002/06/11 16:26:12 roberto Exp roberto $ 2** $Id: ltests.h,v 1.14 2002/06/13 13:45:31 roberto Exp roberto $
3** Internal Header for Debugging of the Lua Implementation 3** Internal Header for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -47,16 +47,15 @@ extern int islocked;
47#define lua_unlock(L) lua_assert(--(**cast(int **, L)) == 0) 47#define lua_unlock(L) lua_assert(--(**cast(int **, L)) == 0)
48 48
49 49
50void luaB_opentests (lua_State *L); 50int luaB_opentests (lua_State *L);
51 51
52#define LUA_USERINIT(L) (luaB_opentests(L), openstdlibs(L)) 52#define lua_userinit(L) (luaB_opentests(L) + openstdlibs(L))
53 53
54 54
55 55
56/* change some sizes to give some bugs a chance */ 56/* change some sizes to give some bugs a chance */
57 57
58#define LUAL_BUFFERSIZE 27 58#define LUAL_BUFFERSIZE 27
59#define ZBSIZE 29
60#define MINSTRTABSIZE 2 59#define MINSTRTABSIZE 2
61 60
62#endif 61#endif
diff --git a/ltm.c b/ltm.c
index 580936e1..d9a8dcac 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.96 2002/06/24 20:17:59 roberto Exp roberto $ 2** $Id: ltm.c,v 1.97 2002/06/25 19:17:22 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -19,7 +19,7 @@
19 19
20const char *const luaT_typenames[] = { 20const char *const luaT_typenames[] = {
21 "nil", "number", "string", "boolean", "table", 21 "nil", "number", "string", "boolean", "table",
22 "userdata", "userdata", "function" 22 "function", "userdata", "userdata"
23}; 23};
24 24
25 25
diff --git a/lua.h b/lua.h
index 7bf7be0d..e7953e4c 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.145 2002/07/01 19:31:10 roberto Exp roberto $ 2** $Id: lua.h,v 1.146 2002/07/09 14:58:28 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -70,9 +70,9 @@ typedef const char * (*lua_Chunkreader) (void *ud, size_t *size);
70#define LUA_TSTRING 2 70#define LUA_TSTRING 2
71#define LUA_TBOOLEAN 3 71#define LUA_TBOOLEAN 3
72#define LUA_TTABLE 4 72#define LUA_TTABLE 4
73#define LUA_TUSERDATA 5 73#define LUA_TFUNCTION 5
74#define LUA_TUDATAVAL 6 74#define LUA_TUSERDATA 6
75#define LUA_TFUNCTION 7 75#define LUA_TLIGHTUSERDATA 7
76 76
77 77
78/* minimum Lua stack available to a C function */ 78/* minimum Lua stack available to a C function */
@@ -158,7 +158,7 @@ LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
158LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...); 158LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
159LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); 159LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
160LUA_API void lua_pushboolean (lua_State *L, int b); 160LUA_API void lua_pushboolean (lua_State *L, int b);
161LUA_API void lua_pushudataval (lua_State *L, void *p); 161LUA_API void lua_pushlightuserdata (lua_State *L, void *p);
162 162
163 163
164/* 164/*
@@ -225,10 +225,10 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
225** =============================================================== 225** ===============================================================
226*/ 226*/
227 227
228#define lua_newpointerbox(L,u) \ 228#define lua_boxpointer(L,u) \
229 (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u)) 229 (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
230 230
231#define lua_getfrombox(L,i) (*(void **)(lua_touserdata(L, i))) 231#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
232 232
233#define lua_pop(L,n) lua_settop(L, -(n)-1) 233#define lua_pop(L,n) lua_settop(L, -(n)-1)
234 234
@@ -241,8 +241,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
241 241
242#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION) 242#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
243#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE) 243#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
244#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA) 244#define lua_isuserdata(L,n) (lua_type(L,n) >= LUA_TUSERDATA)
245#define lua_isudataval(L,n) (lua_type(L,n) == LUA_TUDATAVAL) 245#define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA)
246#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL) 246#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
247#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN) 247#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN)
248#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE) 248#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
diff --git a/lvm.c b/lvm.c
index 8dcd83eb..d966a179 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.246 2002/07/08 20:22:08 roberto Exp roberto $ 2** $Id: lvm.c,v 1.247 2002/07/16 14:26:56 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -263,7 +263,7 @@ int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2) {
263 case LUA_TNUMBER: return nvalue(t1) == nvalue(t2); 263 case LUA_TNUMBER: return nvalue(t1) == nvalue(t2);
264 case LUA_TSTRING: return tsvalue(t1) == tsvalue(t2); 264 case LUA_TSTRING: return tsvalue(t1) == tsvalue(t2);
265 case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ 265 case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
266 case LUA_TUDATAVAL: return pvalue(t1) == pvalue(t2); 266 case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
267 case LUA_TFUNCTION: return clvalue(t1) == clvalue(t2); 267 case LUA_TFUNCTION: return clvalue(t1) == clvalue(t2);
268 case LUA_TUSERDATA: 268 case LUA_TUSERDATA:
269 if (uvalue(t1) == uvalue(t2)) return 1; 269 if (uvalue(t1) == uvalue(t2)) return 1;