|
|
|
@ -67,7 +67,7 @@ static void l_getmetatable(lua_State *L, const char *meta_key) {
|
|
|
|
|
// meta_key is the key assigned to the meta table of the userdata
|
|
|
|
|
static void *l_testudata(lua_State *L, int arg_index, const char *meta_key) {
|
|
|
|
|
void *p = lua_touserdata(L, arg_index);
|
|
|
|
|
int n = lua_gettop(L);
|
|
|
|
|
//int n = lua_gettop(L);
|
|
|
|
|
if (p != NULL) { // value is a userdata?
|
|
|
|
|
if (lua_getmetatable(L, arg_index)) { // does it have a metatable?
|
|
|
|
|
lua_pushlightuserdata(L, (void *)meta_key); // meta_key
|
|
|
|
@ -79,7 +79,7 @@ static void *l_testudata(lua_State *L, int arg_index, const char *meta_key) {
|
|
|
|
|
lua_pop(L, 2); // remove both metatables
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lua_assert(n == lua_gettop(L));
|
|
|
|
|
//lua_assert(n == lua_gettop(L));
|
|
|
|
|
return p; /* to avoid warnings */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|