aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lbaselib.c4
-rw-r--r--lua.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/lbaselib.c b/lbaselib.c
index bd53a38d..96e26a9a 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.215 2009/04/08 18:04:33 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.216 2009/07/08 16:06:07 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*/
@@ -419,6 +419,7 @@ static int luaB_pcall (lua_State *L) {
419 int status; 419 int status;
420 luaL_checkany(L, 1); 420 luaL_checkany(L, 1);
421 status = lua_pcallk(L, lua_gettop(L) - 1, LUA_MULTRET, 0, 0, pcallcont); 421 status = lua_pcallk(L, lua_gettop(L) - 1, LUA_MULTRET, 0, 0, pcallcont);
422 luaL_checkstack(L, 1, NULL);
422 lua_pushboolean(L, (status == LUA_OK)); 423 lua_pushboolean(L, (status == LUA_OK));
423 lua_insert(L, 1); 424 lua_insert(L, 1);
424 return lua_gettop(L); /* return status + all results */ 425 return lua_gettop(L); /* return status + all results */
@@ -434,6 +435,7 @@ static int luaB_xpcall (lua_State *L) {
434 lua_replace(L, 1); 435 lua_replace(L, 1);
435 lua_replace(L, 2); 436 lua_replace(L, 2);
436 status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 1, pcallcont); 437 status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 1, pcallcont);
438 luaL_checkstack(L, 1, NULL);
437 lua_pushboolean(L, (status == LUA_OK)); 439 lua_pushboolean(L, (status == LUA_OK));
438 lua_replace(L, 1); 440 lua_replace(L, 1);
439 return lua_gettop(L); /* return status + all results */ 441 return lua_gettop(L); /* return status + all results */
diff --git a/lua.c b/lua.c
index 2c456cc1..1885364f 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.172 2009/02/19 17:15:35 roberto Exp roberto $ 2** $Id: lua.c,v 1.173 2009/06/18 18:59:58 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -218,6 +218,7 @@ static void dotty (lua_State *L) {
218 if (status == LUA_OK) status = docall(L, 0, 0); 218 if (status == LUA_OK) status = docall(L, 0, 0);
219 report(L, status); 219 report(L, status);
220 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */ 220 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */
221 luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
221 lua_getglobal(L, "print"); 222 lua_getglobal(L, "print");
222 lua_insert(L, 1); 223 lua_insert(L, 1);
223 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK) 224 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)