| 10334 | |
| 10335 | |
| 10336 | LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { |
| 10337 | void *p = lua_touserdata(L, ud); |
| 10338 | if (p != NULL) { /* value is a userdata? */ |
| 10339 | if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ |
| 10340 | lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ |
| 10341 | if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ |
| 10342 | lua_pop(L, 2); /* remove both metatables */ |
| 10343 | return p; |
| 10344 | } |
| 10345 | } |
| 10346 | } |
| 10347 | luaL_typerror(L, ud, tname); /* else error */ |
| 10348 | return NULL; /* to avoid warnings */ |
| 10349 | } |
| 10350 | |
| 10351 | |
| 10352 | LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { |
no test coverage detected