aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-12-29 14:23:32 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-12-29 14:23:32 -0200
commitbfdcbbcd76c7187022fe2d35675de0b1c92eeadf (patch)
treee312b2b1d54e4854693c2e410fb6f0f9bd37c84d /liolib.c
parent30eebb2d1cc2cdd14426b9e80a9e1c576b955f6b (diff)
downloadlua-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/liolib.c b/liolib.c
index eb4df497..fc059e2e 100644
--- a/liolib.c
+++ b/liolib.c
@@ -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
508LUALIB_API int luaopen_io (lua_State *L) { 508LUALIB_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);