summaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-11-10 16:05:36 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-11-10 16:05:36 -0200
commitc97aa9485caf253eceebc00cf08cfa8b179fe35e (patch)
treeb54254b30e4354f4fdad5264cfd4e7baa9e40ab5 /lauxlib.c
parente885b91326986f1b5a341e9ff1444c4f46c6241a (diff)
downloadlua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.tar.gz
lua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.tar.bz2
lua-c97aa9485caf253eceebc00cf08cfa8b179fe35e.zip
new function 'luaL_setmetatable'
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 9dbf5519..b0fabe3f 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.225 2010/11/09 11:04:15 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.226 2010/11/10 17:38:10 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -224,6 +224,12 @@ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
224} 224}
225 225
226 226
227LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {
228 luaL_getmetatable(L, tname);
229 lua_setmetatable(L, -2);
230}
231
232
227LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { 233LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
228 void *p = lua_touserdata(L, ud); 234 void *p = lua_touserdata(L, ud);
229 if (p != NULL) { /* value is a userdata? */ 235 if (p != NULL) { /* value is a userdata? */