diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-11-10 16:05:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-11-10 16:05:36 -0200 |
commit | c97aa9485caf253eceebc00cf08cfa8b179fe35e (patch) | |
tree | b54254b30e4354f4fdad5264cfd4e7baa9e40ab5 /liolib.c | |
parent | e885b91326986f1b5a341e9ff1444c4f46c6241a (diff) | |
download | lua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.tar.gz lua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.tar.bz2 lua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.zip |
new function 'luaL_setmetatable'
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.93 2010/11/08 17:27:22 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.94 2010/11/09 16:57:49 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 | */ |
@@ -114,8 +114,7 @@ static FILE *tofile (lua_State *L) { | |||
114 | static FILE **newprefile (lua_State *L) { | 114 | static FILE **newprefile (lua_State *L) { |
115 | FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); | 115 | FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); |
116 | *pf = NULL; /* file handle is currently `closed' */ | 116 | *pf = NULL; /* file handle is currently `closed' */ |
117 | luaL_getmetatable(L, LUA_FILEHANDLE); | 117 | luaL_setmetatable(L, LUA_FILEHANDLE); |
118 | lua_setmetatable(L, -2); | ||
119 | return pf; | 118 | return pf; |
120 | } | 119 | } |
121 | 120 | ||