aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c8
-rw-r--r--lauxlib.h8
-rw-r--r--lbaselib.c59
-rw-r--r--ldblib.c4
-rw-r--r--liolib.c8
-rw-r--r--lstrlib.c6
-rw-r--r--ltests.c14
7 files changed, 54 insertions, 53 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 7c65dba0..cc1390b9 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.50 2001/04/23 16:35:45 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.51 2001/07/12 18:11:58 roberto Exp $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -54,19 +54,19 @@ static void tag_error (lua_State *L, int narg, int tag) {
54} 54}
55 55
56 56
57LUALIB_API void luaL_checkstack (lua_State *L, int space, const l_char *mes) { 57LUALIB_API void luaL_check_stack (lua_State *L, int space, const l_char *mes) {
58 if (space > lua_stackspace(L)) 58 if (space > lua_stackspace(L))
59 luaL_verror(L, l_s("stack overflow (%.30s)"), mes); 59 luaL_verror(L, l_s("stack overflow (%.30s)"), mes);
60} 60}
61 61
62 62
63LUALIB_API void luaL_checktype(lua_State *L, int narg, int t) { 63LUALIB_API void luaL_check_rawtype(lua_State *L, int narg, int t) {
64 if (lua_rawtag(L, narg) != t) 64 if (lua_rawtag(L, narg) != t)
65 tag_error(L, narg, t); 65 tag_error(L, narg, t);
66} 66}
67 67
68 68
69LUALIB_API void luaL_checkany (lua_State *L, int narg) { 69LUALIB_API void luaL_check_any (lua_State *L, int narg) {
70 if (lua_rawtag(L, narg) == LUA_TNONE) 70 if (lua_rawtag(L, narg) == LUA_TNONE)
71 luaL_argerror(L, narg, l_s("value expected")); 71 luaL_argerror(L, narg, l_s("value expected"));
72} 72}
diff --git a/lauxlib.h b/lauxlib.h
index eef34860..e3da34f3 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.35 2001/04/06 21:17:37 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.36 2001/07/22 00:59:36 roberto Exp $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -36,9 +36,9 @@ LUALIB_API const lua_char *luaL_opt_lstr (lua_State *L, int numArg,
36LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg); 36LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg);
37LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def); 37LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def);
38 38
39LUALIB_API void luaL_checkstack (lua_State *L, int space, const lua_char *msg); 39LUALIB_API void luaL_check_stack (lua_State *L, int space, const lua_char *msg);
40LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); 40LUALIB_API void luaL_check_rawtype (lua_State *L, int narg, int t);
41LUALIB_API void luaL_checkany (lua_State *L, int narg); 41LUALIB_API void luaL_check_any (lua_State *L, int narg);
42LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, 42LUALIB_API void *luaL_check_userdata (lua_State *L, int narg,
43 const lua_char *name); 43 const lua_char *name);
44 44
diff --git a/lbaselib.c b/lbaselib.c
index cbb0cf36..73e5c8e6 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.43 2001/10/11 21:41:21 roberto Exp $ 2** $Id: lbaselib.c,v 1.44 2001/10/17 21:12:57 roberto Exp $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -42,7 +42,7 @@ static int luaB__ALERT (lua_State *L) {
42** The library `liolib' redefines _ERRORMESSAGE for better error information. 42** The library `liolib' redefines _ERRORMESSAGE for better error information.
43*/ 43*/
44static int luaB__ERRORMESSAGE (lua_State *L) { 44static int luaB__ERRORMESSAGE (lua_State *L) {
45 luaL_checktype(L, 1, LUA_TSTRING); 45 luaL_check_rawtype(L, 1, LUA_TSTRING);
46 lua_getglobal(L, l_s(LUA_ALERT)); 46 lua_getglobal(L, l_s(LUA_ALERT));
47 if (lua_isfunction(L, -1)) { /* avoid error loop if _ALERT is not defined */ 47 if (lua_isfunction(L, -1)) { /* avoid error loop if _ALERT is not defined */
48 lua_Debug ar; 48 lua_Debug ar;
@@ -95,7 +95,7 @@ static int luaB_print (lua_State *L) {
95static int luaB_tonumber (lua_State *L) { 95static int luaB_tonumber (lua_State *L) {
96 int base = luaL_opt_int(L, 2, 10); 96 int base = luaL_opt_int(L, 2, 10);
97 if (base == 10) { /* standard conversion */ 97 if (base == 10) { /* standard conversion */
98 luaL_checkany(L, 1); 98 luaL_check_any(L, 1);
99 if (lua_isnumber(L, 1)) { 99 if (lua_isnumber(L, 1)) {
100 lua_pushnumber(L, lua_tonumber(L, 1)); 100 lua_pushnumber(L, lua_tonumber(L, 1));
101 return 1; 101 return 1;
@@ -126,7 +126,7 @@ static int luaB_error (lua_State *L) {
126} 126}
127 127
128static int luaB_setglobal (lua_State *L) { 128static int luaB_setglobal (lua_State *L) {
129 luaL_checkany(L, 2); 129 luaL_check_any(L, 2);
130 lua_setglobal(L, luaL_check_string(L, 1)); 130 lua_setglobal(L, luaL_check_string(L, 1));
131 return 0; 131 return 0;
132} 132}
@@ -157,13 +157,13 @@ static int gettag (lua_State *L, int narg) {
157 157
158 158
159static int luaB_tag (lua_State *L) { 159static int luaB_tag (lua_State *L) {
160 luaL_checkany(L, 1); 160 luaL_check_any(L, 1);
161 lua_pushnumber(L, lua_tag(L, 1)); 161 lua_pushnumber(L, lua_tag(L, 1));
162 return 1; 162 return 1;
163} 163}
164 164
165static int luaB_settype (lua_State *L) { 165static int luaB_settype (lua_State *L) {
166 luaL_checktype(L, 1, LUA_TTABLE); 166 luaL_check_rawtype(L, 1, LUA_TTABLE);
167 lua_pushvalue(L, 1); /* push table */ 167 lua_pushvalue(L, 1); /* push table */
168 lua_settag(L, gettag(L, 2)); 168 lua_settag(L, gettag(L, 2));
169 return 1; /* return table */ 169 return 1; /* return table */
@@ -171,7 +171,7 @@ static int luaB_settype (lua_State *L) {
171 171
172static int luaB_weakmode (lua_State *L) { 172static int luaB_weakmode (lua_State *L) {
173 const l_char *mode = luaL_check_string(L, 2); 173 const l_char *mode = luaL_check_string(L, 2);
174 luaL_checktype(L, 1, LUA_TTABLE); 174 luaL_check_rawtype(L, 1, LUA_TTABLE);
175 if (*mode == l_c('?')) { 175 if (*mode == l_c('?')) {
176 l_char buff[3]; 176 l_char buff[3];
177 l_char *s = buff; 177 l_char *s = buff;
@@ -202,7 +202,7 @@ static int luaB_newtype (lua_State *L) {
202static int luaB_globals (lua_State *L) { 202static int luaB_globals (lua_State *L) {
203 lua_getglobals(L); /* value to be returned */ 203 lua_getglobals(L); /* value to be returned */
204 if (!lua_isnull(L, 1)) { 204 if (!lua_isnull(L, 1)) {
205 luaL_checktype(L, 1, LUA_TTABLE); 205 luaL_check_rawtype(L, 1, LUA_TTABLE);
206 lua_pushvalue(L, 1); /* new table of globals */ 206 lua_pushvalue(L, 1); /* new table of globals */
207 lua_setglobals(L); 207 lua_setglobals(L);
208 } 208 }
@@ -210,16 +210,16 @@ static int luaB_globals (lua_State *L) {
210} 210}
211 211
212static int luaB_rawget (lua_State *L) { 212static int luaB_rawget (lua_State *L) {
213 luaL_checktype(L, 1, LUA_TTABLE); 213 luaL_check_rawtype(L, 1, LUA_TTABLE);
214 luaL_checkany(L, 2); 214 luaL_check_any(L, 2);
215 lua_rawget(L, -2); 215 lua_rawget(L, -2);
216 return 1; 216 return 1;
217} 217}
218 218
219static int luaB_rawset (lua_State *L) { 219static int luaB_rawset (lua_State *L) {
220 luaL_checktype(L, 1, LUA_TTABLE); 220 luaL_check_rawtype(L, 1, LUA_TTABLE);
221 luaL_checkany(L, 2); 221 luaL_check_any(L, 2);
222 luaL_checkany(L, 3); 222 luaL_check_any(L, 3);
223 lua_rawset(L, -3); 223 lua_rawset(L, -3);
224 return 1; 224 return 1;
225} 225}
@@ -262,21 +262,21 @@ static int luaB_collectgarbage (lua_State *L) {
262 262
263 263
264static int luaB_type (lua_State *L) { 264static int luaB_type (lua_State *L) {
265 luaL_checkany(L, 1); 265 luaL_check_any(L, 1);
266 lua_pushstring(L, lua_type(L, 1)); 266 lua_pushstring(L, lua_type(L, 1));
267 return 1; 267 return 1;
268} 268}
269 269
270 270
271static int luaB_rawtype (lua_State *L) { 271static int luaB_rawtype (lua_State *L) {
272 luaL_checkany(L, 1); 272 luaL_check_any(L, 1);
273 lua_pushstring(L, lua_tag2name(L, lua_rawtag(L, 1))); 273 lua_pushstring(L, lua_tag2name(L, lua_rawtag(L, 1)));
274 return 1; 274 return 1;
275} 275}
276 276
277 277
278static int luaB_next (lua_State *L) { 278static int luaB_next (lua_State *L) {
279 luaL_checktype(L, 1, LUA_TTABLE); 279 luaL_check_rawtype(L, 1, LUA_TTABLE);
280 lua_settop(L, 2); /* create a 2nd argument if there isn't one */ 280 lua_settop(L, 2); /* create a 2nd argument if there isn't one */
281 if (lua_next(L, 1)) 281 if (lua_next(L, 1))
282 return 2; 282 return 2;
@@ -394,9 +394,9 @@ static int luaB_require (lua_State *L) {
394 394
395static int aux_unpack (lua_State *L, int arg) { 395static int aux_unpack (lua_State *L, int arg) {
396 int n, i; 396 int n, i;
397 luaL_checktype(L, arg, LUA_TTABLE); 397 luaL_check_rawtype(L, arg, LUA_TTABLE);
398 n = lua_getn(L, arg); 398 n = lua_getn(L, arg);
399 luaL_checkstack(L, n, l_s("table too big to unpack")); 399 luaL_check_stack(L, n, l_s("table too big to unpack"));
400 for (i=1; i<=n; i++) /* push arg[1...n] */ 400 for (i=1; i<=n; i++) /* push arg[1...n] */
401 lua_rawgeti(L, arg, i); 401 lua_rawgeti(L, arg, i);
402 return n; 402 return n;
@@ -479,8 +479,8 @@ static int luaB_tostring (lua_State *L) {
479 479
480static int luaB_foreachi (lua_State *L) { 480static int luaB_foreachi (lua_State *L) {
481 int n, i; 481 int n, i;
482 luaL_checktype(L, 1, LUA_TTABLE); 482 luaL_check_rawtype(L, 1, LUA_TTABLE);
483 luaL_checktype(L, 2, LUA_TFUNCTION); 483 luaL_check_rawtype(L, 2, LUA_TFUNCTION);
484 n = lua_getn(L, 1); 484 n = lua_getn(L, 1);
485 for (i=1; i<=n; i++) { 485 for (i=1; i<=n; i++) {
486 lua_pushvalue(L, 2); /* function */ 486 lua_pushvalue(L, 2); /* function */
@@ -496,8 +496,8 @@ static int luaB_foreachi (lua_State *L) {
496 496
497 497
498static int luaB_foreach (lua_State *L) { 498static int luaB_foreach (lua_State *L) {
499 luaL_checktype(L, 1, LUA_TTABLE); 499 luaL_check_rawtype(L, 1, LUA_TTABLE);
500 luaL_checktype(L, 2, LUA_TFUNCTION); 500 luaL_check_rawtype(L, 2, LUA_TFUNCTION);
501 lua_pushnil(L); /* first index */ 501 lua_pushnil(L); /* first index */
502 for (;;) { 502 for (;;) {
503 if (lua_next(L, 1) == 0) 503 if (lua_next(L, 1) == 0)
@@ -514,16 +514,17 @@ static int luaB_foreach (lua_State *L) {
514 514
515 515
516static int luaB_assert (lua_State *L) { 516static int luaB_assert (lua_State *L) {
517 luaL_checkany(L, 1); 517 luaL_check_any(L, 1);
518 if (lua_isnil(L, 1)) 518 if (lua_isnil(L, 1))
519 luaL_verror(L, l_s("assertion failed! %.90s"), luaL_opt_string(L, 2, l_s(""))); 519 luaL_verror(L, l_s("assertion failed! %.90s"),
520 luaL_opt_string(L, 2, l_s("")));
520 lua_settop(L, 1); 521 lua_settop(L, 1);
521 return 1; 522 return 1;
522} 523}
523 524
524 525
525static int luaB_getn (lua_State *L) { 526static int luaB_getn (lua_State *L) {
526 luaL_checktype(L, 1, LUA_TTABLE); 527 luaL_check_rawtype(L, 1, LUA_TTABLE);
527 lua_pushnumber(L, lua_getn(L, 1)); 528 lua_pushnumber(L, lua_getn(L, 1));
528 return 1; 529 return 1;
529} 530}
@@ -532,7 +533,7 @@ static int luaB_getn (lua_State *L) {
532static int luaB_tinsert (lua_State *L) { 533static int luaB_tinsert (lua_State *L) {
533 int v = lua_gettop(L); /* number of arguments */ 534 int v = lua_gettop(L); /* number of arguments */
534 int n, pos; 535 int n, pos;
535 luaL_checktype(L, 1, LUA_TTABLE); 536 luaL_check_rawtype(L, 1, LUA_TTABLE);
536 n = lua_getn(L, 1); 537 n = lua_getn(L, 1);
537 if (v == 2) /* called with only 2 arguments */ 538 if (v == 2) /* called with only 2 arguments */
538 pos = n+1; 539 pos = n+1;
@@ -553,7 +554,7 @@ static int luaB_tinsert (lua_State *L) {
553 554
554static int luaB_tremove (lua_State *L) { 555static int luaB_tremove (lua_State *L) {
555 int pos, n; 556 int pos, n;
556 luaL_checktype(L, 1, LUA_TTABLE); 557 luaL_check_rawtype(L, 1, LUA_TTABLE);
557 n = lua_getn(L, 1); 558 n = lua_getn(L, 1);
558 pos = luaL_opt_int(L, 2, n); 559 pos = luaL_opt_int(L, 2, n);
559 if (n <= 0) return 0; /* table is `empty' */ 560 if (n <= 0) return 0; /* table is `empty' */
@@ -665,10 +666,10 @@ static void auxsort (lua_State *L, int l, int u) {
665 666
666static int luaB_sort (lua_State *L) { 667static int luaB_sort (lua_State *L) {
667 int n; 668 int n;
668 luaL_checktype(L, 1, LUA_TTABLE); 669 luaL_check_rawtype(L, 1, LUA_TTABLE);
669 n = lua_getn(L, 1); 670 n = lua_getn(L, 1);
670 if (!lua_isnull(L, 2)) /* is there a 2nd argument? */ 671 if (!lua_isnull(L, 2)) /* is there a 2nd argument? */
671 luaL_checktype(L, 2, LUA_TFUNCTION); 672 luaL_check_rawtype(L, 2, LUA_TFUNCTION);
672 lua_settop(L, 2); /* make sure there is two arguments */ 673 lua_settop(L, 2); /* make sure there is two arguments */
673 auxsort(L, 1, n); 674 auxsort(L, 1, n);
674 return 0; 675 return 0;
diff --git a/ldblib.c b/ldblib.c
index 3c95fdb8..ea435b89 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.38 2001/08/31 19:46:07 roberto Exp $ 2** $Id: ldblib.c,v 1.39 2001/10/17 21:12:57 roberto Exp $
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*/
@@ -104,7 +104,7 @@ static int setlocal (lua_State *L) {
104 lua_Debug ar; 104 lua_Debug ar;
105 if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */ 105 if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
106 luaL_argerror(L, 1, l_s("level out of range")); 106 luaL_argerror(L, 1, l_s("level out of range"));
107 luaL_checkany(L, 3); 107 luaL_check_any(L, 3);
108 lua_pushstring(L, lua_setlocal(L, &ar, luaL_check_int(L, 2))); 108 lua_pushstring(L, lua_setlocal(L, &ar, luaL_check_int(L, 2)));
109 return 1; 109 return 1;
110} 110}
diff --git a/liolib.c b/liolib.c
index 2a9f11b9..4114eae3 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.122 2001/08/31 19:46:07 roberto Exp $ 2** $Id: liolib.c,v 1.123 2001/10/02 16:41:36 roberto Exp $
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*/
@@ -254,7 +254,7 @@ static int read_until (lua_State *L, FILE *f, const l_char *p, int pl) {
254 254
255 255
256static int read_number (lua_State *L, FILE *f) { 256static int read_number (lua_State *L, FILE *f) {
257 double d; 257 lua_Number d;
258 if (fscanf(f, l_s(LUA_NUMBER_SCAN), &d) == 1) { 258 if (fscanf(f, l_s(LUA_NUMBER_SCAN), &d) == 1) {
259 lua_pushnumber(L, d); 259 lua_pushnumber(L, d);
260 return 1; 260 return 1;
@@ -299,7 +299,7 @@ static int io_read (lua_State *L) {
299 n = 2; /* will return n-1 results */ 299 n = 2; /* will return n-1 results */
300 } 300 }
301 else { /* ensure stack space for all results and for auxlib's buffer */ 301 else { /* ensure stack space for all results and for auxlib's buffer */
302 luaL_checkstack(L, nargs+LUA_MINSTACK, l_s("too many arguments")); 302 luaL_check_stack(L, nargs+LUA_MINSTACK, l_s("too many arguments"));
303 success = 1; 303 success = 1;
304 for (n = 1; n<=nargs && success; n++) { 304 for (n = 1; n<=nargs && success; n++) {
305 if (lua_rawtag(L, n) == LUA_TNUMBER) { 305 if (lua_rawtag(L, n) == LUA_TNUMBER) {
@@ -515,7 +515,7 @@ static int io_time (lua_State *L) {
515 else { 515 else {
516 time_t t; 516 time_t t;
517 struct tm ts; 517 struct tm ts;
518 luaL_checktype(L, 1, LUA_TTABLE); 518 luaL_check_rawtype(L, 1, LUA_TTABLE);
519 lua_settop(L, 1); /* make sure table is at the top */ 519 lua_settop(L, 1); /* make sure table is at the top */
520 ts.tm_sec = getfield(L, l_s("sec"), 0); 520 ts.tm_sec = getfield(L, l_s("sec"), 0);
521 ts.tm_min = getfield(L, l_s("min"), 0); 521 ts.tm_min = getfield(L, l_s("min"), 0);
diff --git a/lstrlib.c b/lstrlib.c
index fc27a6a4..9a6f04d1 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.71 2001/08/31 19:46:07 roberto Exp $ 2** $Id: lstrlib.c,v 1.72 2001/10/16 17:41:43 roberto Exp $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -92,7 +92,7 @@ static int str_concat (lua_State *L) {
92 size_t lsep; 92 size_t lsep;
93 const char *sep = luaL_opt_lstr(L, 2, "", &lsep); 93 const char *sep = luaL_opt_lstr(L, 2, "", &lsep);
94 int n, i; 94 int n, i;
95 luaL_checktype(L, 1, LUA_TTABLE); 95 luaL_check_rawtype(L, 1, LUA_TTABLE);
96 luaL_buffinit(L, &b); 96 luaL_buffinit(L, &b);
97 n = lua_getn(L, 1); 97 n = lua_getn(L, 1);
98 for (i=1; i<=n; i++) { 98 for (i=1; i<=n; i++) {
@@ -431,7 +431,7 @@ static void push_onecapture (MatchState *ms, int i) {
431 431
432static int push_captures (MatchState *ms) { 432static int push_captures (MatchState *ms) {
433 int i; 433 int i;
434 luaL_checkstack(ms->L, ms->level, l_s("too many captures")); 434 luaL_check_stack(ms->L, ms->level, l_s("too many captures"));
435 for (i=0; i<ms->level; i++) 435 for (i=0; i<ms->level; i++)
436 push_onecapture(ms, i); 436 push_onecapture(ms, i);
437 return ms->level; /* number of strings pushed */ 437 return ms->level; /* number of strings pushed */
diff --git a/ltests.c b/ltests.c
index 4b6e3de2..90179586 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.93 2001/10/17 21:12:57 roberto Exp $ 2** $Id: ltests.c,v 1.94 2001/10/25 19:14:14 roberto Exp $
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*/
@@ -247,7 +247,7 @@ static int hash_query (lua_State *L) {
247 else { 247 else {
248 TObject *o = luaA_index(L, 1); 248 TObject *o = luaA_index(L, 1);
249 Table *t; 249 Table *t;
250 luaL_checktype(L, 2, LUA_TTABLE); 250 luaL_check_rawtype(L, 2, LUA_TTABLE);
251 t = hvalue(luaA_index(L, 2)); 251 t = hvalue(luaA_index(L, 2));
252 lua_pushnumber(L, luaH_mainposition(t, o) - t->node); 252 lua_pushnumber(L, luaH_mainposition(t, o) - t->node);
253 } 253 }
@@ -258,7 +258,7 @@ static int hash_query (lua_State *L) {
258static int table_query (lua_State *L) { 258static int table_query (lua_State *L) {
259 const Table *t; 259 const Table *t;
260 int i = luaL_opt_int(L, 2, -1); 260 int i = luaL_opt_int(L, 2, -1);
261 luaL_checktype(L, 1, LUA_TTABLE); 261 luaL_check_rawtype(L, 1, LUA_TTABLE);
262 t = hvalue(luaA_index(L, 1)); 262 t = hvalue(luaA_index(L, 1));
263 if (i == -1) { 263 if (i == -1) {
264 lua_pushnumber(L, t->sizearray); 264 lua_pushnumber(L, t->sizearray);
@@ -312,7 +312,7 @@ static int string_query (lua_State *L) {
312 312
313static int tref (lua_State *L) { 313static int tref (lua_State *L) {
314 int level = lua_gettop(L); 314 int level = lua_gettop(L);
315 luaL_checkany(L, 1); 315 luaL_check_any(L, 1);
316 lua_pushvalue(L, 1); 316 lua_pushvalue(L, 1);
317 lua_pushnumber(L, lua_ref(L, 1)); 317 lua_pushnumber(L, lua_ref(L, 1));
318 assert(lua_gettop(L) == level+1); /* +1 for result */ 318 assert(lua_gettop(L) == level+1); /* +1 for result */
@@ -346,14 +346,14 @@ static int newuserdatabox (lua_State *L) {
346} 346}
347 347
348static int settag (lua_State *L) { 348static int settag (lua_State *L) {
349 luaL_checkany(L, 1); 349 luaL_check_any(L, 1);
350 lua_pushvalue(L, 1); /* push value */ 350 lua_pushvalue(L, 1); /* push value */
351 lua_settag(L, luaL_check_int(L, 2)); 351 lua_settag(L, luaL_check_int(L, 2));
352 return 1; /* return value */ 352 return 1; /* return value */
353} 353}
354 354
355static int udataval (lua_State *L) { 355static int udataval (lua_State *L) {
356 luaL_checktype(L, 1, LUA_TUSERDATA); 356 luaL_check_rawtype(L, 1, LUA_TUSERDATA);
357 lua_pushnumber(L, cast(int, lua_touserdata(L, 1))); 357 lua_pushnumber(L, cast(int, lua_touserdata(L, 1)));
358 return 1; 358 return 1;
359} 359}
@@ -438,7 +438,7 @@ static int doremote (lua_State *L) {
438static int settagmethod (lua_State *L) { 438static int settagmethod (lua_State *L) {
439 int tag = luaL_check_int(L, 1); 439 int tag = luaL_check_int(L, 1);
440 const l_char *event = luaL_check_string(L, 2); 440 const l_char *event = luaL_check_string(L, 2);
441 luaL_checkany(L, 3); 441 luaL_check_any(L, 3);
442 lua_gettagmethod(L, tag, event); 442 lua_gettagmethod(L, tag, event);
443 lua_pushvalue(L, 3); 443 lua_pushvalue(L, 3);
444 lua_settagmethod(L, tag, event); 444 lua_settagmethod(L, tag, event);