From 7da55e899bdf0a6864abc78b2138dc52b847303c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 11 Apr 2009 13:38:20 +0200 Subject: [PATCH] luaa: remove luaA_toudata() Signed-off-by: Julien Danjou --- luaa.c | 2 +- luaa.h | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/luaa.c b/luaa.c index bd023a4fc..3affd72ba 100644 --- a/luaa.c +++ b/luaa.c @@ -413,7 +413,7 @@ luaAe_type(lua_State *L) luaL_checkany(L, 1); #define CHECK_TYPE(type) \ do { \ - if(luaA_toudata2(L, 1, #type) || luaA_toudata(L, 1, #type)) \ + if(luaA_toudata2(L, 1, #type)) \ { \ lua_pushliteral(L, #type); \ return 1; \ diff --git a/luaa.h b/luaa.h index 9d43c0e3a..86002128f 100644 --- a/luaa.h +++ b/luaa.h @@ -107,30 +107,6 @@ luaA_dumpstack(lua_State *L) fprintf(stderr, "------- Lua stack dump end ------\n"); } -/** Convert a object to a udata if possible. - * \param L The Lua VM state. - * \param ud The index. - * \param tname The type name. - * \return A pointer to the object, NULL otherwise. - */ -static inline void * -luaA_toudata(lua_State *L, int ud, const char *tname) -{ - void **p = lua_touserdata(L, ud); - if(p && *p) /* value is a userdata? */ - if(lua_getmetatable(L, ud)) /* does it have a metatable? */ - { - lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - if(lua_rawequal(L, -1, -2)) /* does it have the correct mt? */ - { - lua_pop(L, 2); /* remove both metatables */ - return p; - } - lua_pop(L, 2); /* remove both metatables */ - } - return NULL; -} - /** Convert a object to a udata if possible. * \param L The Lua VM state. * \param ud The index.