diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lapi.c | 3 | ||||
| -rw-r--r-- | src/ldo.c | 8 |
2 files changed, 7 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.47 1999/06/22 20:37:23 roberto Exp $ +** $Id: lapi.c,v 1.47b 1999/06/22 20:37:23 roberto Exp $ ** Lua API ** See Copyright Notice in lua.h */ @@ -179,6 +179,7 @@ lua_Object lua_rawgettable (void) { void lua_settable (void) { checkCparams(3); + luaD_checkstack(3); /* may need that to call T.M. */ luaV_settable(L->stack.top-3); L->stack.top -= 2; /* pop table and index */ } @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.45 1999/06/22 20:37:23 roberto Exp $ +** $Id: ldo.c,v 1.45b 1999/06/22 20:37:23 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -357,12 +357,14 @@ int lua_dofile (char *filename) { FILE *f = (filename == NULL) ? stdin : fopen(filename, "r"); if (f == NULL) return 2; + luaL_filesource(source, filename, sizeof(source)); c = fgetc(f); ungetc(c, f); bin = (c == ID_CHUNK); - if (bin) + if (bin && f != stdin) { f = freopen(filename, "rb", f); /* set binary mode */ - luaL_filesource(source, filename, sizeof(source)); + if (f == NULL) return 2; + } luaZ_Fopen(&z, f, source); status = do_main(&z, bin); if (f != stdin) |
