aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lbaselib.c b/lbaselib.c
index e876f1e6..56f927e5 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.3 2000/09/12 18:41:43 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.4 2000/09/13 19:52:39 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*/
@@ -51,7 +51,7 @@ static int luaB__ERRORMESSAGE (lua_State *L) {
51 } 51 }
52 lua_pushstring(L, "\n"); 52 lua_pushstring(L, "\n");
53 lua_concat(L, 3); 53 lua_concat(L, 3);
54 lua_call(L, 1, 0); 54 lua_rawcall(L, 1, 0);
55 } 55 }
56 return 0; 56 return 0;
57} 57}
@@ -71,8 +71,7 @@ static int luaB_print (lua_State *L) {
71 const char *s; 71 const char *s;
72 lua_pushvalue(L, -1); /* function to be called */ 72 lua_pushvalue(L, -1); /* function to be called */
73 lua_pushvalue(L, i); /* value to print */ 73 lua_pushvalue(L, i); /* value to print */
74 if (lua_call(L, 1, 1) != 0) 74 lua_rawcall(L, 1, 1);
75 lua_error(L, NULL);
76 s = lua_tostring(L, -1); /* get result */ 75 s = lua_tostring(L, -1); /* get result */
77 if (s == NULL) 76 if (s == NULL)
78 lua_error(L, "`tostring' must return a string to `print'"); 77 lua_error(L, "`tostring' must return a string to `print'");
@@ -335,8 +334,7 @@ static int luaB_foreachi (lua_State *L) {
335 lua_pushvalue(L, 2); /* function */ 334 lua_pushvalue(L, 2); /* function */
336 lua_pushnumber(L, i); /* 1st argument */ 335 lua_pushnumber(L, i); /* 1st argument */
337 lua_rawgeti(L, 1, i); /* 2nd argument */ 336 lua_rawgeti(L, 1, i); /* 2nd argument */
338 if (lua_call(L, 2, 1) != 0) 337 lua_rawcall(L, 2, 1);
339 lua_error(L, NULL);
340 if (!lua_isnil(L, -1)) 338 if (!lua_isnil(L, -1))
341 return 1; 339 return 1;
342 lua_pop(L, 1); /* remove nil result */ 340 lua_pop(L, 1); /* remove nil result */
@@ -355,7 +353,7 @@ static int luaB_foreach (lua_State *L) {
355 lua_pushvalue(L, 2); /* function */ 353 lua_pushvalue(L, 2); /* function */
356 lua_pushvalue(L, -3); /* key */ 354 lua_pushvalue(L, -3); /* key */
357 lua_pushvalue(L, -3); /* value */ 355 lua_pushvalue(L, -3); /* value */
358 if (lua_call(L, 2, 1) != 0) lua_error(L, NULL); 356 lua_rawcall(L, 2, 1);
359 if (!lua_isnil(L, -1)) 357 if (!lua_isnil(L, -1))
360 return 1; 358 return 1;
361 lua_pop(L, 2); /* remove value and result */ 359 lua_pop(L, 2); /* remove value and result */
@@ -450,7 +448,7 @@ static int sort_comp (lua_State *L, int n, int r) {
450 lua_pushvalue(L, -2); /* pivot */ 448 lua_pushvalue(L, -2); /* pivot */
451 lua_rawgeti(L, 1, n); /* a[n] */ 449 lua_rawgeti(L, 1, n); /* a[n] */
452 } 450 }
453 if (lua_call(L, 2, 1) != 0) lua_error(L, NULL); 451 lua_rawcall(L, 2, 1);
454 res = !lua_isnil(L, -1); 452 res = !lua_isnil(L, -1);
455 } 453 }
456 else { /* a < b? */ 454 else { /* a < b? */
@@ -553,8 +551,7 @@ static int deprecated_func (lua_State *L) {
553 lua_insert(L, 1); /* upvalue is the function to be called */ 551 lua_insert(L, 1); /* upvalue is the function to be called */
554 lua_getglobals(L); 552 lua_getglobals(L);
555 lua_insert(L, 2); /* table of globals is 1o argument */ 553 lua_insert(L, 2); /* table of globals is 1o argument */
556 if (lua_call(L, lua_gettop(L)-1, LUA_MULTRET) != 0) 554 lua_rawcall(L, lua_gettop(L)-1, LUA_MULTRET);
557 lua_error(L, NULL);
558 return lua_gettop(L); /* return all results */ 555 return lua_gettop(L); /* return all results */
559} 556}
560 557