diff options
| author | Lua Team <team@lua.org> | 2000-02-22 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2000-02-22 12:00:00 +0000 |
| commit | b7610da5fed99f59ac73ae452da8839a0f2c1bda (patch) | |
| tree | dc18aa9fc220b4d560aa2a71949e885ca9c077bf /src | |
| parent | e7eacfb8851d87e681e6f5a1fbead87565b4aa46 (diff) | |
| download | lua-github-b7610da5fed99f59ac73ae452da8839a0f2c1bda.tar.gz | |
Lua 3.2.23.2.2
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) |
