diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-29 14:23:32 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-29 14:23:32 -0200 |
commit | bfdcbbcd76c7187022fe2d35675de0b1c92eeadf (patch) | |
tree | e312b2b1d54e4854693c2e410fb6f0f9bd37c84d /liolib.c | |
parent | 30eebb2d1cc2cdd14426b9e80a9e1c576b955f6b (diff) | |
download | lua-bfdcbbcd76c7187022fe2d35675de0b1c92eeadf.tar.gz lua-bfdcbbcd76c7187022fe2d35675de0b1c92eeadf.tar.bz2 lua-bfdcbbcd76c7187022fe2d35675de0b1c92eeadf.zip |
small optimizations (lua_newtable -> lua_createtable)
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.68 2005/10/14 16:24:11 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.69 2005/10/19 13:05: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 | */ |
@@ -507,8 +507,8 @@ static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { | |||
507 | 507 | ||
508 | LUALIB_API int luaopen_io (lua_State *L) { | 508 | LUALIB_API int luaopen_io (lua_State *L) { |
509 | createmeta(L); | 509 | createmeta(L); |
510 | /* create new (private) environment */ | 510 | /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ |
511 | lua_newtable(L); | 511 | lua_createtable(L, 2, 1); |
512 | lua_replace(L, LUA_ENVIRONINDEX); | 512 | lua_replace(L, LUA_ENVIRONINDEX); |
513 | /* open library */ | 513 | /* open library */ |
514 | luaL_register(L, LUA_IOLIBNAME, iolib); | 514 | luaL_register(L, LUA_IOLIBNAME, iolib); |
@@ -518,7 +518,7 @@ LUALIB_API int luaopen_io (lua_State *L) { | |||
518 | createstdfile(L, stderr, 0, "stderr"); | 518 | createstdfile(L, stderr, 0, "stderr"); |
519 | /* create environment for 'popen' */ | 519 | /* create environment for 'popen' */ |
520 | lua_getfield(L, -1, "popen"); | 520 | lua_getfield(L, -1, "popen"); |
521 | lua_newtable(L); | 521 | lua_createtable(L, 0, 1); |
522 | lua_pushcfunction(L, io_pclose); | 522 | lua_pushcfunction(L, io_pclose); |
523 | lua_setfield(L, -2, "__close"); | 523 | lua_setfield(L, -2, "__close"); |
524 | lua_setfenv(L, -2); | 524 | lua_setfenv(L, -2); |