From bfdcbbcd76c7187022fe2d35675de0b1c92eeadf Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 29 Dec 2005 14:23:32 -0200 Subject: small optimizations (lua_newtable -> lua_createtable) --- liolib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index eb4df497..fc059e2e 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.68 2005/10/14 16:24:11 roberto Exp roberto $ +** $Id: liolib.c,v 2.69 2005/10/19 13:05:11 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -507,8 +507,8 @@ static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { LUALIB_API int luaopen_io (lua_State *L) { createmeta(L); - /* create new (private) environment */ - lua_newtable(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + lua_createtable(L, 2, 1); lua_replace(L, LUA_ENVIRONINDEX); /* open library */ luaL_register(L, LUA_IOLIBNAME, iolib); @@ -518,7 +518,7 @@ LUALIB_API int luaopen_io (lua_State *L) { createstdfile(L, stderr, 0, "stderr"); /* create environment for 'popen' */ lua_getfield(L, -1, "popen"); - lua_newtable(L); + lua_createtable(L, 0, 1); lua_pushcfunction(L, io_pclose); lua_setfield(L, -2, "__close"); lua_setfenv(L, -2); -- cgit v1.2.3-55-g6feb