summaryrefslogtreecommitdiff
path: root/src/lauxlib.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2011-12-05 12:00:00 +0000
committerrepogen <>2011-12-05 12:00:00 +0000
commit3a66913821e41b57d0f5e5f464d0b7b35b4cc131 (patch)
treeb35640d90c10aefe47e7822eb5de583d6fb94a64 /src/lauxlib.c
parented0f7cc8d3f96dce4dac98bc395506f0513a332c (diff)
downloadlua-github-5.2.0-rc5.tar.gz
Lua 5.2.0-rc55.2.0-rc5
Diffstat (limited to 'src/lauxlib.c')
-rw-r--r--src/lauxlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lauxlib.c b/src/lauxlib.c
index 5339bc54..4c044f9d 100644
--- a/src/lauxlib.c
+++ b/src/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.238 2011/11/30 12:58:57 roberto Exp $
+** $Id: lauxlib.c,v 1.239 2011/12/02 13:25:57 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -269,7 +269,7 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) {
*/
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
- lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
+ luaL_getmetatable(L, tname); /* try to get metatable */
if (!lua_isnil(L, -1)) /* name already in use? */
return 0; /* leave previous value on top, but return 0 */
lua_pop(L, 1);
@@ -290,7 +290,7 @@ LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
void *p = lua_touserdata(L, ud);
if (p != NULL) { /* value is a userdata? */
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
- lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
+ luaL_getmetatable(L, tname); /* get correct metatable */
if (!lua_rawequal(L, -1, -2)) /* not the same? */
p = NULL; /* value is a userdata with wrong metatable */
lua_pop(L, 2); /* remove both metatables */