| 301 | } |
| 302 | |
| 303 | void *luaL_testudata (lua_State *L, int i, const char *tname) { |
| 304 | void *p = lua_touserdata(L, i); |
| 305 | luaL_checkstack(L, 2, "not enough stack slots"); |
| 306 | if (p == NULL || !lua_getmetatable(L, i)) |
| 307 | return NULL; |
| 308 | else { |
| 309 | int res = 0; |
| 310 | luaL_getmetatable(L, tname); |
| 311 | res = lua_rawequal(L, -1, -2); |
| 312 | lua_pop(L, 2); |
| 313 | if (!res) |
| 314 | p = NULL; |
| 315 | } |
| 316 | return p; |
| 317 | } |
| 318 | |
| 319 | void luaL_setmetatable (lua_State *L, const char *tname) { |
| 320 | luaL_checkstack(L, 1, "not enough stack slots"); |
no test coverage detected