From c97aa9485caf253eceebc00cf08cfa8b179fe35e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 10 Nov 2010 16:05:36 -0200 Subject: new function 'luaL_setmetatable' --- liolib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index 6786201a..4b15fd35 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.93 2010/11/08 17:27:22 roberto Exp roberto $ +** $Id: liolib.c,v 2.94 2010/11/09 16:57:49 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -114,8 +114,7 @@ static FILE *tofile (lua_State *L) { static FILE **newprefile (lua_State *L) { FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); *pf = NULL; /* file handle is currently `closed' */ - luaL_getmetatable(L, LUA_FILEHANDLE); - lua_setmetatable(L, -2); + luaL_setmetatable(L, LUA_FILEHANDLE); return pf; } -- cgit v1.2.3-55-g6feb