diff options
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.87 2010/03/17 21:37:37 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.88 2010/03/26 20:58:11 roberto Exp roberto $ |
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 | */ |
@@ -615,8 +615,9 @@ LUAMOD_API int luaopen_io (lua_State *L) { | |||
615 | createmeta(L); | 615 | createmeta(L); |
616 | /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ | 616 | /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ |
617 | newenv(L, io_fclose); /* upvalue for all io functions at index 1 */ | 617 | newenv(L, io_fclose); /* upvalue for all io functions at index 1 */ |
618 | lua_pushvalue(L, -1); /* copy to be consumed by 'openlib' */ | 618 | luaL_newlibtable(L, iolib); /* new module at index 2 */ |
619 | luaL_openlib(L, LUA_IOLIBNAME, iolib, 1); /* new module at index 2 */ | 619 | lua_pushvalue(L, 1); /* copy of env to be consumed by 'setfuncs' */ |
620 | luaL_setfuncs(L, iolib, 1); | ||
620 | /* create (and set) default files */ | 621 | /* create (and set) default files */ |
621 | newenv(L, io_noclose); /* environment for default files at index 3 */ | 622 | newenv(L, io_noclose); /* environment for default files at index 3 */ |
622 | createstdfile(L, stdin, IO_INPUT, "stdin"); | 623 | createstdfile(L, stdin, IO_INPUT, "stdin"); |